jodit 3.19.4 → 3.20.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/build/jodit.css +45 -42
- package/build/jodit.es2018.css +38 -36
- package/build/jodit.es2018.en.css +38 -36
- package/build/jodit.es2018.en.js +22562 -25637
- package/build/jodit.es2018.en.min.css +1 -1
- package/build/jodit.es2018.en.min.js +1 -1
- package/build/jodit.es2018.js +23105 -26181
- package/build/jodit.es2018.min.css +1 -1
- package/build/jodit.es2018.min.js +1 -1
- package/build/jodit.js +797 -386
- package/build/jodit.min.css +2 -2
- package/build/jodit.min.js +1 -1
- package/build/plugins/debug/debug.es2018.en.js +97 -0
- package/build/plugins/debug/debug.es2018.en.min.js +1 -0
- package/build/plugins/debug/debug.es2018.js +97 -0
- package/build/plugins/debug/debug.es2018.min.js +1 -0
- package/build/plugins/debug/debug.js +96 -0
- package/build/plugins/debug/debug.min.js +1 -0
- package/build/plugins/speech-recognize/speech-recognize.css +1 -1
- package/build/plugins/speech-recognize/speech-recognize.es2018.css +1 -1
- package/build/plugins/speech-recognize/speech-recognize.es2018.en.css +1 -1
- package/build/plugins/speech-recognize/speech-recognize.es2018.en.js +331 -398
- package/build/plugins/speech-recognize/speech-recognize.es2018.en.min.js +1 -1
- package/build/plugins/speech-recognize/speech-recognize.es2018.js +331 -398
- package/build/plugins/speech-recognize/speech-recognize.es2018.min.js +1 -1
- package/build/plugins/speech-recognize/speech-recognize.js +1 -1
- package/build/vdom.css +1 -1
- package/build/vdom.js +1 -1
- package/index.html +2 -2
- package/package.json +9 -4
- package/src/config.ts +4 -2
- package/src/core/constants.ts +7 -7
- package/src/core/decorators/derive/README.md +71 -0
- package/src/core/decorators/derive/derive.ts +48 -0
- package/src/core/decorators/index.ts +1 -0
- package/src/core/decorators/spy/spy.ts +5 -0
- package/src/core/dom/dom.test.js +0 -1
- package/src/core/dom/dom.ts +28 -13
- package/src/core/event-emitter/observable.ts +3 -3
- package/src/core/helpers/helpers.test.js +0 -170
- package/src/core/plugin/plugin-system.ts +20 -0
- package/src/core/selection/select.ts +27 -9
- package/src/core/selection/style/api/toggle/toggle-ordered-list.ts +5 -1
- package/src/core/selection/style/api/wrap-ordered-list.ts +5 -1
- package/src/core/selection/style/api/wrap-unwrapped-text.ts +1 -1
- package/src/core/selection/style/style.test.js +1 -1
- package/src/core/{view/panel.ts → traits/dlgs.ts} +17 -9
- package/src/core/traits/elms.ts +4 -8
- package/src/core/traits/index.ts +1 -0
- package/src/core/traits/mods.ts +17 -10
- package/src/core/ui/button/index.ts +1 -0
- package/src/{plugins → core/ui/button}/tooltip/README.md +0 -0
- package/src/{plugins → core/ui/button}/tooltip/tooltip.less +4 -4
- package/src/{plugins → core/ui/button}/tooltip/tooltip.test.js +3 -2
- package/src/core/ui/button/tooltip/tooltip.ts +132 -0
- package/src/core/ui/element.ts +5 -27
- package/src/core/ui/group/group.test.js +44 -0
- package/src/core/ui/group/group.ts +4 -4
- package/src/core/view/view-with-toolbar.ts +2 -2
- package/src/core/view/view.ts +11 -33
- package/src/jodit.ts +20 -8
- package/src/langs/ar.js +1 -1
- package/src/langs/cs_cz.js +1 -1
- package/src/langs/de.js +1 -1
- package/src/langs/es.js +1 -1
- package/src/langs/fa.js +1 -1
- package/src/langs/fr.js +1 -1
- package/src/langs/he.js +1 -1
- package/src/langs/hu.js +1 -1
- package/src/langs/i18n.test.js +170 -0
- package/src/langs/id.js +1 -1
- package/src/langs/it.js +1 -1
- package/src/langs/ja.js +1 -1
- package/src/langs/ko.js +1 -1
- package/src/langs/nl.js +1 -1
- package/src/langs/pl.js +1 -1
- package/src/langs/pt_br.js +1 -1
- package/src/langs/ru.js +1 -1
- package/src/langs/tr.js +1 -1
- package/src/langs/zh_cn.js +1 -1
- package/src/langs/zh_tw.js +1 -1
- package/src/modules/dialog/dialog.less +2 -0
- package/src/modules/dialog/dialog.ts +27 -50
- package/src/modules/file-browser/README.md +10 -10
- package/src/modules/file-browser/__image_snapshots__/file-browser-test-screenshot-js-filebrowser-screenshot-testing-open-filebrowser-works-1-snap.png +0 -0
- package/src/modules/file-browser/builders/context-menu.ts +1 -1
- package/src/modules/file-browser/file-browser.test.js +26 -13
- package/src/modules/file-browser/file-browser.test.screenshot.js +23 -0
- package/src/modules/file-browser/file-browser.ts +9 -5
- package/src/modules/history/snapshot.ts +12 -3
- package/src/modules/image-editor/__image_snapshots__/image-editor-test-screenshot-js-image-editor-screenshot-testing-open-image-editor-works-1-snap.png +0 -0
- package/src/modules/image-editor/image-editor.test.screenshot.js +25 -0
- package/src/modules/image-editor/image-editor.ts +7 -6
- package/src/modules/status-bar/status-bar.ts +5 -16
- package/src/modules/table/table.test.js +2 -1
- package/src/modules/toolbar/collection/collection.ts +6 -1
- package/src/modules/uploader/README.md +1 -1
- package/src/modules/uploader/config.ts +1 -1
- package/src/modules/uploader/uploader.test.js +96 -46
- package/src/plugins/about/about.ts +1 -1
- package/src/plugins/add-new-line/add-new-line.ts +5 -4
- package/src/plugins/backspace/backspace.test.js +33 -39
- package/src/plugins/backspace/backspace.ts +10 -4
- package/src/plugins/backspace/cases/check-remove-char.ts +36 -14
- package/src/plugins/backspace/cases/check-remove-unbreakable-element.ts +8 -0
- package/src/plugins/backspace/config.ts +1 -1
- package/src/plugins/backspace/interface.d.ts +1 -1
- package/src/plugins/clean-html/clean-html.test.js +240 -164
- package/src/plugins/clean-html/config.ts +10 -2
- package/src/plugins/clean-html/helpers/remove-format/remove-format-for-collapsed-selection.ts +3 -2
- package/src/plugins/clean-html/helpers/remove-format/remove-format-for-selection.ts +2 -2
- package/src/plugins/clean-html/helpers/visitor/filters/index.ts +1 -0
- package/src/plugins/clean-html/helpers/visitor/filters/remove-empty-text-node.ts +35 -0
- package/src/plugins/clean-html/helpers/visitor/filters/remove-inv-text-nodes.ts +2 -6
- package/src/plugins/clean-html/helpers/visitor/visit-node-walker.ts +5 -0
- package/src/plugins/debug/debug.ts +68 -0
- package/src/plugins/drag-and-drop/drag-and-drop.ts +0 -1
- package/src/plugins/drag-and-drop-element/drag-and-drop-element.test.js +37 -34
- package/src/plugins/dtd/README.md +52 -0
- package/{types/plugins/tooltip/tooltip.d.ts → src/plugins/dtd/after-insert/index.ts} +5 -4
- package/src/plugins/dtd/after-insert/remove-extra-br.ts +39 -0
- package/src/plugins/dtd/before-insert/check-block-nesting.ts +40 -0
- package/src/plugins/dtd/before-insert/index.ts +12 -0
- package/src/plugins/dtd/config.ts +67 -0
- package/src/plugins/dtd/dtd.test.js +128 -0
- package/src/plugins/dtd/dtd.ts +48 -0
- package/src/plugins/enter/enter.test.js +89 -193
- package/src/plugins/enter/enter.ts +14 -11
- package/src/plugins/enter/helpers/check-br.ts +11 -1
- package/src/plugins/enter/helpers/index.ts +1 -0
- package/src/plugins/enter/helpers/move-cursor-out-from-specal-tags.ts +32 -0
- package/src/plugins/enter/helpers/split-fragment.ts +1 -0
- package/src/plugins/fullsize/config.ts +1 -1
- package/src/plugins/fullsize/fullsize.test.js +77 -12
- package/src/plugins/fullsize/fullsize.ts +12 -1
- package/src/plugins/iframe/config.ts +1 -1
- package/src/plugins/image-properties/README.md +7 -0
- package/src/plugins/image-properties/image-properties.ts +1 -1
- package/src/plugins/index.ts +1 -1
- package/src/plugins/limit/limit.test.js +27 -0
- package/src/plugins/limit/limit.ts +4 -2
- package/src/plugins/line-height/line-height.svg +1 -1
- package/src/plugins/link/README.md +5 -0
- package/src/plugins/link/link.test.js +11 -12
- package/src/plugins/link/link.ts +1 -1
- package/src/plugins/mobile/mobile.ts +1 -1
- package/src/plugins/ordered-list/ordered-list.test.js +3 -14
- package/src/plugins/paste/config.ts +0 -7
- package/src/plugins/paste/paste.test.js +3 -3
- package/src/plugins/paste-storage/paste-storage.ts +1 -1
- package/src/plugins/preview/preview.ts +1 -1
- package/src/plugins/search/search.ts +1 -1
- package/src/plugins/select/config.ts +1 -1
- package/src/plugins/spellcheck/config.ts +1 -1
- package/src/plugins/symbols/symbols.test.js +5 -4
- package/src/plugins/table/config.ts +4 -17
- package/src/plugins/table/table.test.js +2 -2
- package/src/plugins/wrap-nodes/wrap-nodes.test.js +34 -5
- package/src/plugins/wrap-nodes/wrap-nodes.ts +59 -16
- package/src/styles/variables.less +1 -1
- package/src/types/ajax.d.ts +2 -2
- package/src/types/file-browser.d.ts +4 -2
- package/src/types/jodit.d.ts +3 -2
- package/src/types/plugin.d.ts +1 -0
- package/src/types/toolbar.d.ts +12 -6
- package/src/types/traits.d.ts +30 -1
- package/src/types/types.d.ts +1 -0
- package/src/types/view.d.ts +9 -34
- package/src/typings.d.ts +1 -0
- package/types/config.d.ts +3 -2
- package/types/core/constants.d.ts +7 -7
- package/types/core/decorators/derive/derive.d.ts +6 -0
- package/types/core/decorators/index.d.ts +1 -0
- package/types/core/dom/dom.d.ts +5 -4
- package/types/core/plugin/plugin-system.d.ts +4 -0
- package/types/core/traits/dlgs.d.ts +15 -0
- package/types/core/traits/elms.d.ts +2 -4
- package/types/core/traits/index.d.ts +1 -0
- package/types/core/traits/mods.d.ts +5 -8
- package/types/core/ui/button/index.d.ts +1 -0
- package/types/core/ui/button/tooltip/tooltip.d.ts +29 -0
- package/types/core/ui/element.d.ts +3 -9
- package/types/core/ui/group/group.d.ts +2 -2
- package/types/core/view/view-with-toolbar.d.ts +2 -2
- package/types/core/view/view.d.ts +5 -10
- package/types/jodit.d.ts +7 -4
- package/types/modules/dialog/dialog.d.ts +8 -10
- package/types/modules/file-browser/file-browser.d.ts +5 -2
- package/types/modules/history/snapshot.d.ts +3 -2
- package/types/modules/image-editor/image-editor.d.ts +4 -4
- package/types/modules/status-bar/status-bar.d.ts +3 -4
- package/types/modules/toolbar/collection/collection.d.ts +1 -0
- package/types/plugins/clean-html/config.d.ts +7 -1
- package/types/plugins/clean-html/helpers/visitor/filters/index.d.ts +1 -0
- package/types/plugins/clean-html/helpers/visitor/filters/remove-empty-text-node.d.ts +13 -0
- package/types/plugins/dtd/after-insert/index.d.ts +10 -0
- package/types/plugins/dtd/after-insert/remove-extra-br.d.ts +16 -0
- package/types/plugins/dtd/before-insert/check-block-nesting.d.ts +16 -0
- package/types/plugins/dtd/before-insert/index.d.ts +10 -0
- package/types/plugins/dtd/config.d.ts +27 -0
- package/types/plugins/dtd/dtd.d.ts +6 -0
- package/types/plugins/enter/helpers/index.d.ts +1 -0
- package/types/plugins/enter/helpers/move-cursor-out-from-specal-tags.d.ts +13 -0
- package/types/plugins/iframe/config.d.ts +1 -1
- package/types/plugins/index.d.ts +1 -1
- package/types/plugins/paste/config.d.ts +0 -4
- package/types/plugins/spellcheck/config.d.ts +1 -1
- package/types/types/ajax.d.ts +2 -2
- package/types/types/file-browser.d.ts +4 -2
- package/types/types/jodit.d.ts +3 -2
- package/types/types/plugin.d.ts +1 -0
- package/types/types/toolbar.d.ts +12 -6
- package/types/types/traits.d.ts +30 -1
- package/types/types/types.d.ts +1 -0
- package/types/types/view.d.ts +9 -34
- package/src/plugins/tooltip/tooltip.ts +0 -114
- package/types/core/view/panel.d.ts +0 -13
|
@@ -29,10 +29,18 @@ class wrapNodes extends Plugin {
|
|
|
29
29
|
return;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
jodit.e
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
jodit.e
|
|
33
|
+
.on(
|
|
34
|
+
'drop.wtn focus.wtn keydown.wtn mousedown.wtn',
|
|
35
|
+
this.preprocessInput,
|
|
36
|
+
{
|
|
37
|
+
top: true
|
|
38
|
+
}
|
|
39
|
+
)
|
|
40
|
+
.on(
|
|
41
|
+
'afterInit.wtn postProcessSetEditorValue.wtn',
|
|
42
|
+
this.postProcessSetEditorValue
|
|
43
|
+
);
|
|
36
44
|
}
|
|
37
45
|
|
|
38
46
|
/** @override **/
|
|
@@ -55,7 +63,7 @@ class wrapNodes extends Plugin {
|
|
|
55
63
|
isChanged: boolean = false;
|
|
56
64
|
|
|
57
65
|
while (child) {
|
|
58
|
-
this.checkAloneListLeaf(child, jodit);
|
|
66
|
+
child = this.checkAloneListLeaf(child, jodit);
|
|
59
67
|
|
|
60
68
|
if (this.isSuitableStart(child)) {
|
|
61
69
|
if (!isChanged) {
|
|
@@ -74,6 +82,7 @@ class wrapNodes extends Plugin {
|
|
|
74
82
|
}
|
|
75
83
|
|
|
76
84
|
box.normalize();
|
|
85
|
+
child = box;
|
|
77
86
|
}
|
|
78
87
|
|
|
79
88
|
child = child && child.nextSibling;
|
|
@@ -88,17 +97,33 @@ class wrapNodes extends Plugin {
|
|
|
88
97
|
}
|
|
89
98
|
}
|
|
90
99
|
|
|
91
|
-
private checkAloneListLeaf(
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
100
|
+
private checkAloneListLeaf(child: Node, jodit: IJodit): Node {
|
|
101
|
+
// debugger
|
|
102
|
+
let result = child;
|
|
103
|
+
let next: Nullable<Node> = child;
|
|
104
|
+
|
|
105
|
+
do {
|
|
106
|
+
if (
|
|
107
|
+
Dom.isElement(next) &&
|
|
108
|
+
Dom.isTag(next, 'li') &&
|
|
109
|
+
!Dom.isTag(next.parentElement, ['ul', 'ol'])
|
|
110
|
+
) {
|
|
111
|
+
const nextChild: Nullable<Node> = Dom.findNotEmptySibling(
|
|
112
|
+
next,
|
|
113
|
+
false
|
|
114
|
+
);
|
|
115
|
+
if (Dom.isTag(result, 'ul')) {
|
|
116
|
+
result.appendChild(next);
|
|
117
|
+
} else {
|
|
118
|
+
result = Dom.wrap(next, 'ul', jodit.createInside);
|
|
119
|
+
}
|
|
120
|
+
next = nextChild;
|
|
121
|
+
} else {
|
|
122
|
+
break;
|
|
123
|
+
}
|
|
124
|
+
} while (next);
|
|
125
|
+
|
|
126
|
+
return result;
|
|
102
127
|
}
|
|
103
128
|
|
|
104
129
|
/**
|
|
@@ -120,6 +145,24 @@ class wrapNodes extends Plugin {
|
|
|
120
145
|
private isNotClosed = (n: Nullable<Node>): n is Element =>
|
|
121
146
|
Dom.isElement(n) &&
|
|
122
147
|
!(Dom.isBlock(n) || Dom.isTag(n, this.j.o.wrapNodes.exclude));
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Process input without parent box
|
|
151
|
+
*/
|
|
152
|
+
@autobind
|
|
153
|
+
private preprocessInput(): void {
|
|
154
|
+
const { jodit } = this;
|
|
155
|
+
|
|
156
|
+
if (!jodit.isEditorMode() || jodit.editor.firstChild) {
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
const box = jodit.createInside.element(jodit.o.enter);
|
|
161
|
+
const br = jodit.createInside.element('br');
|
|
162
|
+
Dom.append(box, br);
|
|
163
|
+
Dom.append(jodit.editor, box);
|
|
164
|
+
jodit.s.setCursorBefore(br);
|
|
165
|
+
}
|
|
123
166
|
}
|
|
124
167
|
|
|
125
168
|
pluginSystem.add('wrapNodes', wrapNodes);
|
|
@@ -80,10 +80,10 @@
|
|
|
80
80
|
//z-index
|
|
81
81
|
--z-index-full-size: 100000;
|
|
82
82
|
--z-index-popup: 10000001;
|
|
83
|
-
--z-index-tooltip: 10000002;
|
|
84
83
|
--z-index-dialog-overlay: 20000003;
|
|
85
84
|
--z-index-dialog: 20000004;
|
|
86
85
|
--z-index-context-menu: 30000005;
|
|
86
|
+
--z-index-tooltip: 30000006;
|
|
87
87
|
|
|
88
88
|
--icon-loader-size: 48px;
|
|
89
89
|
|
package/src/types/ajax.d.ts
CHANGED
|
@@ -82,8 +82,8 @@ export interface AjaxOptions {
|
|
|
82
82
|
|
|
83
83
|
/**
|
|
84
84
|
* An object (or a function which returns an object) of additional header key/value pairs to send along
|
|
85
|
-
* with requests using the XMLHttpRequest transport. Uses in
|
|
86
|
-
* and
|
|
85
|
+
* with requests using the XMLHttpRequest transport. Uses in [[FileBrowser]]
|
|
86
|
+
* and [[Uploader]]
|
|
87
87
|
*/
|
|
88
88
|
headers?:
|
|
89
89
|
| IDictionary<string>
|
|
@@ -17,10 +17,11 @@ import type {
|
|
|
17
17
|
Nullable
|
|
18
18
|
} from './types';
|
|
19
19
|
import type { IUploader, IUploaderOptions } from './uploader';
|
|
20
|
-
import type {
|
|
20
|
+
import type { IViewOptions, IViewWithToolbar } from './view';
|
|
21
21
|
import type { IUIGroup } from './ui';
|
|
22
22
|
import type { IObservable } from './events';
|
|
23
23
|
import type { IAjax } from './ajax';
|
|
24
|
+
import type { IDlgs } from './traits';
|
|
24
25
|
|
|
25
26
|
/**
|
|
26
27
|
* The module creates a web browser dialog box. In a Web browser ,you can select an image, remove, drag it. Upload new
|
|
@@ -252,7 +253,8 @@ export interface IFileBrowserDataProvider extends IDestructible {
|
|
|
252
253
|
// TODO - Remove extending
|
|
253
254
|
export interface IFileBrowser<
|
|
254
255
|
T extends IFileBrowserOptions = IFileBrowserOptions
|
|
255
|
-
> extends
|
|
256
|
+
> extends IViewWithToolbar<T>,
|
|
257
|
+
IDlgs {
|
|
256
258
|
readonly dataProvider: IFileBrowserDataProvider;
|
|
257
259
|
readonly state: IFileBrowserState & IObservable;
|
|
258
260
|
|
package/src/types/jodit.d.ts
CHANGED
|
@@ -8,12 +8,13 @@
|
|
|
8
8
|
* @module types
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import { IViewOptions,
|
|
11
|
+
import { IViewOptions, IViewWithToolbar } from './view';
|
|
12
12
|
import type { Config } from 'jodit/config';
|
|
13
13
|
import type {
|
|
14
14
|
CustomCommand,
|
|
15
15
|
ICreate,
|
|
16
16
|
IDestructible,
|
|
17
|
+
IDlgs,
|
|
17
18
|
IHistory,
|
|
18
19
|
IStatusBar,
|
|
19
20
|
Modes
|
|
@@ -34,7 +35,7 @@ interface IWorkPlace {
|
|
|
34
35
|
options: IViewOptions;
|
|
35
36
|
}
|
|
36
37
|
|
|
37
|
-
interface IJodit extends
|
|
38
|
+
interface IJodit extends IViewWithToolbar, IDlgs {
|
|
38
39
|
isJodit: true;
|
|
39
40
|
|
|
40
41
|
options: Config;
|
package/src/types/plugin.d.ts
CHANGED
|
@@ -54,6 +54,7 @@ export interface IExtraPlugin {
|
|
|
54
54
|
|
|
55
55
|
export interface IPluginSystem {
|
|
56
56
|
add(name: string, plugin: any): void;
|
|
57
|
+
wait(name: string): Promise<void>;
|
|
57
58
|
get(name: string): PluginType | void;
|
|
58
59
|
remove(name: string): void;
|
|
59
60
|
init(jodit: IJodit): CanPromise<void>;
|
package/src/types/toolbar.d.ts
CHANGED
|
@@ -17,7 +17,8 @@ import type {
|
|
|
17
17
|
IViewBased,
|
|
18
18
|
IJodit,
|
|
19
19
|
IMods,
|
|
20
|
-
IBound
|
|
20
|
+
IBound,
|
|
21
|
+
IContainer
|
|
21
22
|
} from './';
|
|
22
23
|
import type { IFileBrowser } from './file-browser';
|
|
23
24
|
|
|
@@ -113,7 +114,7 @@ interface IControlType<
|
|
|
113
114
|
|
|
114
115
|
/**
|
|
115
116
|
* Drop-down list. A hash or array. You must specify the command which will be submitted for the hash key
|
|
116
|
-
* (or array value) (see .[[
|
|
117
|
+
* (or array value) (see .[[IJodit.execCommand]] or define 'exec' function. See example
|
|
117
118
|
* @example
|
|
118
119
|
* ```javascript
|
|
119
120
|
* Jodit.make('#editor2', {
|
|
@@ -146,8 +147,8 @@ interface IControlType<
|
|
|
146
147
|
|
|
147
148
|
/**
|
|
148
149
|
* The command executes when the button is pressed. Allowed all
|
|
149
|
-
*
|
|
150
|
-
* and several specific [[
|
|
150
|
+
* @see https://developer.mozilla.org/ru/docs/Web/API/Document/execCommand#commands
|
|
151
|
+
* and several specific [[IJodit.execCommand]]
|
|
151
152
|
*/
|
|
152
153
|
command?: string;
|
|
153
154
|
tagRegExp?: RegExp;
|
|
@@ -209,7 +210,12 @@ interface IControlType<
|
|
|
209
210
|
* The method which will be called for each element of button.list
|
|
210
211
|
*/
|
|
211
212
|
template?: (jodit: T, key: string, value: string) => string;
|
|
212
|
-
childTemplate?: (
|
|
213
|
+
childTemplate?: (
|
|
214
|
+
jodit: T,
|
|
215
|
+
key: string,
|
|
216
|
+
value: string,
|
|
217
|
+
button: IToolbarButton
|
|
218
|
+
) => string;
|
|
213
219
|
|
|
214
220
|
/**
|
|
215
221
|
* After click on the button it will show popup element which consist value that this function returned
|
|
@@ -311,7 +317,7 @@ interface IToolbarCollection extends IUIList {
|
|
|
311
317
|
showInline(bound?: IBound): void;
|
|
312
318
|
}
|
|
313
319
|
|
|
314
|
-
export interface IStatusBar extends IComponent, IMods {
|
|
320
|
+
export interface IStatusBar extends IContainer, IComponent, IMods {
|
|
315
321
|
show(): void;
|
|
316
322
|
hide(): void;
|
|
317
323
|
isShown: boolean;
|
package/src/types/traits.d.ts
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import type { IDictionary, Nullable } from 'jodit/types';
|
|
12
|
+
import type { IComponent, IContainer, IDialog, IDialogOptions } from 'jodit/types';
|
|
12
13
|
|
|
13
14
|
export type ModType = string | boolean | null;
|
|
14
15
|
|
|
@@ -16,7 +17,9 @@ export interface IMods {
|
|
|
16
17
|
/**
|
|
17
18
|
* Set/remove modification (null - remove)
|
|
18
19
|
*/
|
|
19
|
-
setMod(name: string, value: ModType):
|
|
20
|
+
setMod<T extends IComponent & IContainer & IMods>(this: T, name: string, value: ModType): T;
|
|
21
|
+
afterSetMod(name: string, value: ModType): void;
|
|
22
|
+
|
|
20
23
|
getMod(name: string): ModType;
|
|
21
24
|
mods: IDictionary<ModType>;
|
|
22
25
|
}
|
|
@@ -25,3 +28,29 @@ export interface IElms {
|
|
|
25
28
|
getElm(elementName: string): Nullable<HTMLElement>;
|
|
26
29
|
getElms(elementName: string): HTMLElement[];
|
|
27
30
|
}
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
export interface IDlgs {
|
|
34
|
+
dlg(options?: IDialogOptions): IDialog;
|
|
35
|
+
|
|
36
|
+
confirm(
|
|
37
|
+
msg: string,
|
|
38
|
+
title: string | ((yes: boolean) => void) | undefined,
|
|
39
|
+
callback?: (yes: boolean) => void | false
|
|
40
|
+
): IDialog;
|
|
41
|
+
|
|
42
|
+
prompt(
|
|
43
|
+
msg: string,
|
|
44
|
+
title: string | (() => false | void) | undefined,
|
|
45
|
+
callback: (value: string) => false | void,
|
|
46
|
+
placeholder?: string,
|
|
47
|
+
defaultValue?: string
|
|
48
|
+
): IDialog;
|
|
49
|
+
|
|
50
|
+
alert(
|
|
51
|
+
msg: string | HTMLElement,
|
|
52
|
+
title?: string | (() => void | false),
|
|
53
|
+
callback?: string | ((dialog: IDialog) => void | false),
|
|
54
|
+
className?: string
|
|
55
|
+
): IDialog;
|
|
56
|
+
}
|
package/src/types/types.d.ts
CHANGED
package/src/types/view.d.ts
CHANGED
|
@@ -23,8 +23,7 @@ import type { IStorage } from './storage';
|
|
|
23
23
|
import type { IUIButtonState } from './ui';
|
|
24
24
|
import type { IEventEmitter } from './events';
|
|
25
25
|
import type { IPluginButton } from './plugin';
|
|
26
|
-
import type {
|
|
27
|
-
import type { IDialog, IDialogOptions } from './dialog';
|
|
26
|
+
import type { IElms, IMods } from './traits';
|
|
28
27
|
|
|
29
28
|
interface ILanguageOptions {
|
|
30
29
|
language?: string;
|
|
@@ -90,16 +89,17 @@ interface IViewOptions extends ILanguageOptions, IToolbarOptions {
|
|
|
90
89
|
interface IViewBased<T = IViewOptions>
|
|
91
90
|
extends IContainer,
|
|
92
91
|
IComponent,
|
|
93
|
-
|
|
94
|
-
|
|
92
|
+
IMods,
|
|
93
|
+
IElms {
|
|
95
94
|
readonly isView: true;
|
|
95
|
+
readonly parent: Nullable<IViewBased>;
|
|
96
96
|
|
|
97
97
|
/**
|
|
98
98
|
* ID attribute for source element, id add \{id\}_editor it's editor's id
|
|
99
99
|
*/
|
|
100
100
|
readonly id: string;
|
|
101
101
|
|
|
102
|
-
basePath: string;
|
|
102
|
+
readonly basePath: string;
|
|
103
103
|
|
|
104
104
|
readonly isLocked: boolean;
|
|
105
105
|
isLockedNotBy(name: string): boolean;
|
|
@@ -112,7 +112,7 @@ interface IViewBased<T = IViewOptions>
|
|
|
112
112
|
readonly buffer: IStorage;
|
|
113
113
|
readonly storage: IStorage;
|
|
114
114
|
|
|
115
|
-
progressbar: IProgressBar;
|
|
115
|
+
readonly progressbar: IProgressBar;
|
|
116
116
|
|
|
117
117
|
readonly events: IEventEmitter;
|
|
118
118
|
readonly e: this['events'];
|
|
@@ -125,11 +125,11 @@ interface IViewBased<T = IViewOptions>
|
|
|
125
125
|
// alias
|
|
126
126
|
readonly o: this['options'];
|
|
127
127
|
|
|
128
|
-
i18n
|
|
128
|
+
i18n(text: string, ...params: Array<string | number>): string;
|
|
129
129
|
|
|
130
|
-
defaultTimeout: number;
|
|
130
|
+
readonly defaultTimeout: number;
|
|
131
131
|
|
|
132
|
-
getVersion
|
|
132
|
+
getVersion(): string;
|
|
133
133
|
|
|
134
134
|
readonly components: Set<IComponent>;
|
|
135
135
|
getInstance<T extends IComponent>(moduleName: string, options?: object): T;
|
|
@@ -146,28 +146,3 @@ interface IViewWithToolbar<T = IViewOptions> extends IViewBased<T> {
|
|
|
146
146
|
|
|
147
147
|
setPanel(element: HTMLElement | string): void;
|
|
148
148
|
}
|
|
149
|
-
|
|
150
|
-
interface IPanel<T = IViewOptions> extends IViewWithToolbar<T> {
|
|
151
|
-
dialog(options?: IDialogOptions): IDialog;
|
|
152
|
-
|
|
153
|
-
confirm(
|
|
154
|
-
msg: string,
|
|
155
|
-
title: string | ((yes: boolean) => void) | undefined,
|
|
156
|
-
callback?: (yes: boolean) => void | false
|
|
157
|
-
): IDialog;
|
|
158
|
-
|
|
159
|
-
prompt(
|
|
160
|
-
msg: string,
|
|
161
|
-
title: string | (() => false | void) | undefined,
|
|
162
|
-
callback: (value: string) => false | void,
|
|
163
|
-
placeholder?: string,
|
|
164
|
-
defaultValue?: string
|
|
165
|
-
): IDialog;
|
|
166
|
-
|
|
167
|
-
alert(
|
|
168
|
-
msg: string | HTMLElement,
|
|
169
|
-
title?: string | (() => void | false),
|
|
170
|
-
callback?: string | ((dialog: IDialog) => void | false),
|
|
171
|
-
className?: string
|
|
172
|
-
): IDialog;
|
|
173
|
-
}
|
package/src/typings.d.ts
CHANGED
package/types/config.d.ts
CHANGED
|
@@ -117,6 +117,7 @@ export declare class Config implements IViewOptions {
|
|
|
117
117
|
*/
|
|
118
118
|
disabled: boolean;
|
|
119
119
|
activeButtonsInReadOnly: string[];
|
|
120
|
+
allowCommandsInReadOnly: string[];
|
|
120
121
|
/**
|
|
121
122
|
* Size of icons in the toolbar (can be "small", "middle", "large")
|
|
122
123
|
*
|
|
@@ -153,8 +154,8 @@ export declare class Config implements IViewOptions {
|
|
|
153
154
|
/**
|
|
154
155
|
* Class name that can be appended to the editor
|
|
155
156
|
*
|
|
156
|
-
* @see
|
|
157
|
-
* @see
|
|
157
|
+
* @see [[Config.iframeCSSLinks]]
|
|
158
|
+
* @see [[Config.iframeStyle]]
|
|
158
159
|
*
|
|
159
160
|
* @example
|
|
160
161
|
* ```javascript
|
|
@@ -46,7 +46,7 @@ export declare const MODE_WYSIWYG = 1;
|
|
|
46
46
|
export declare const MODE_SOURCE = 2;
|
|
47
47
|
/**
|
|
48
48
|
* Source code editor and HTML editor both like
|
|
49
|
-
*
|
|
49
|
+
* @see http://getuikit.com/docs/htmleditor.html|this
|
|
50
50
|
*/
|
|
51
51
|
export declare const MODE_SPLIT = 3;
|
|
52
52
|
/**
|
|
@@ -75,33 +75,33 @@ export declare const EMULATE_DBLCLICK_TIMEOUT = 300;
|
|
|
75
75
|
export declare const INSERT_AS_HTML = "insert_as_html";
|
|
76
76
|
/**
|
|
77
77
|
* Same as [[INSERT_AS_HTML]], but content will be stripped of extra styles and empty tags
|
|
78
|
-
* ```
|
|
78
|
+
* ```html
|
|
79
79
|
* <h1 style="color:red">test</h1>
|
|
80
80
|
* ```
|
|
81
81
|
* Will be inserted into the document as
|
|
82
|
-
* ```
|
|
82
|
+
* ```html
|
|
83
83
|
* <h1>test</h1>
|
|
84
84
|
* ```
|
|
85
85
|
*/
|
|
86
86
|
export declare const INSERT_CLEAR_HTML = "insert_clear_html";
|
|
87
87
|
/**
|
|
88
88
|
* The contents of the clipboard will be pasted into the document as plain text, i.e. all tags will be displayed as text.
|
|
89
|
-
* ```
|
|
89
|
+
* ```html
|
|
90
90
|
* <h1>test</h1>
|
|
91
91
|
* ```
|
|
92
92
|
* Will be inserted into the document as
|
|
93
|
-
* ```
|
|
93
|
+
* ```html
|
|
94
94
|
* ><h1>test</h1>
|
|
95
95
|
* ```
|
|
96
96
|
*/
|
|
97
97
|
export declare const INSERT_AS_TEXT = "insert_as_text";
|
|
98
98
|
/**
|
|
99
99
|
* All tags will be stripped:
|
|
100
|
-
* ```
|
|
100
|
+
* ```html
|
|
101
101
|
* <h1>test</h1>
|
|
102
102
|
* ```
|
|
103
103
|
* Will be inserted into the document as
|
|
104
|
-
* ```
|
|
104
|
+
* ```html
|
|
105
105
|
* test
|
|
106
106
|
* ```
|
|
107
107
|
*/
|
|
@@ -0,0 +1,6 @@
|
|
|
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
|
+
export declare function derive(...traits: Function[]): (target: Function) => void;
|
package/types/core/dom/dom.d.ts
CHANGED
|
@@ -44,7 +44,7 @@ export declare class Dom {
|
|
|
44
44
|
* // Replace the first <span> element to the < p >
|
|
45
45
|
* ```
|
|
46
46
|
*/
|
|
47
|
-
static replace(elm:
|
|
47
|
+
static replace<T extends Node>(elm: Node, newTagName: HTMLTagNames | Node | string, create: ICreate, withAttributes?: boolean, notMoveContent?: boolean): T;
|
|
48
48
|
/**
|
|
49
49
|
* Checks whether the Node text and blank (in this case it may contain invisible auxiliary characters ,
|
|
50
50
|
* it is also empty )
|
|
@@ -152,7 +152,7 @@ export declare class Dom {
|
|
|
152
152
|
/**
|
|
153
153
|
* Returns the nearest non-empty sibling
|
|
154
154
|
*/
|
|
155
|
-
static findNotEmptySibling(node: Node,
|
|
155
|
+
static findNotEmptySibling(node: Node, left: boolean): Nullable<Node>;
|
|
156
156
|
/**
|
|
157
157
|
* Returns the nearest non-empty neighbor
|
|
158
158
|
*/
|
|
@@ -205,6 +205,7 @@ export declare class Dom {
|
|
|
205
205
|
* Safe remove element from DOM
|
|
206
206
|
*/
|
|
207
207
|
static safeRemove(...nodes: unknown[]): void;
|
|
208
|
+
static safeInsertNode(range: Range, node: Node): void;
|
|
208
209
|
/**
|
|
209
210
|
* Hide element
|
|
210
211
|
*/
|
|
@@ -216,8 +217,8 @@ export declare class Dom {
|
|
|
216
217
|
/**
|
|
217
218
|
* Check if element is some tag
|
|
218
219
|
*/
|
|
219
|
-
static isTag<K extends
|
|
220
|
-
static isTag<K extends
|
|
220
|
+
static isTag<K extends HTMLTagNames>(node: Node | null | undefined | false | EventTarget, tagName: K): node is HTMLElementTagNameMap[K];
|
|
221
|
+
static isTag<K extends HTMLTagNames>(node: Node | null | undefined | false | EventTarget, tagNames: K[]): node is HTMLElementTagNameMap[K];
|
|
221
222
|
/**
|
|
222
223
|
* Marks an item as temporary
|
|
223
224
|
*/
|
|
@@ -39,6 +39,10 @@ export declare class PluginSystem implements IPluginSystem {
|
|
|
39
39
|
* Public method for async init all plugins
|
|
40
40
|
*/
|
|
41
41
|
init(jodit: IJodit): CanPromise<void>;
|
|
42
|
+
/**
|
|
43
|
+
* Returns the promise to wait for the plugin to load.
|
|
44
|
+
*/
|
|
45
|
+
wait(name: string): Promise<void>;
|
|
42
46
|
/**
|
|
43
47
|
* Plugin type has disabled requires
|
|
44
48
|
*/
|
|
@@ -0,0 +1,15 @@
|
|
|
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 traits
|
|
8
|
+
*/
|
|
9
|
+
import type { IDialog, IDialogOptions, IViewBased, IDlgs } from 'jodit/types';
|
|
10
|
+
export declare abstract class Dlgs implements IDlgs {
|
|
11
|
+
dlg(this: IViewBased & IDlgs, options?: IDialogOptions): IDialog;
|
|
12
|
+
confirm(this: IViewBased & IDlgs, msg: string, title: string | ((yes: boolean) => void) | undefined, callback?: (yes: boolean) => void | false): IDialog;
|
|
13
|
+
prompt(this: IViewBased & IDlgs, msg: string, title: string | (() => false | void) | undefined, callback: (value: string) => false | void, placeholder?: string, defaultValue?: string): IDialog;
|
|
14
|
+
alert(this: IViewBased & IDlgs, msg: string | HTMLElement, title?: string | (() => void | false), callback?: string | ((dialog: IDialog) => void | false), className?: string): IDialog;
|
|
15
|
+
}
|
|
@@ -8,14 +8,12 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import type { IComponent, IContainer, IElms, Nullable } from 'jodit/types';
|
|
10
10
|
export declare abstract class Elms implements IElms {
|
|
11
|
-
abstract getElm(elementName: string): Nullable<HTMLElement>;
|
|
12
|
-
abstract getElms(elementName: string): HTMLElement[];
|
|
13
11
|
/**
|
|
14
12
|
* Return element with BEM class name
|
|
15
13
|
*/
|
|
16
|
-
|
|
14
|
+
getElm<T extends IComponent & IContainer & IElms>(this: T, elementName: string): Nullable<HTMLElement>;
|
|
17
15
|
/**
|
|
18
16
|
* Return elements with BEM class name
|
|
19
17
|
*/
|
|
20
|
-
|
|
18
|
+
getElms<T extends IComponent & IContainer & IElms>(this: T, elementName: string): HTMLElement[];
|
|
21
19
|
}
|
|
@@ -6,21 +6,18 @@
|
|
|
6
6
|
/**
|
|
7
7
|
* @module traits
|
|
8
8
|
*/
|
|
9
|
-
import type {
|
|
9
|
+
import type { IContainer, IDictionary, IMods, IComponent, ModType } from 'jodit/types';
|
|
10
10
|
export declare abstract class Mods implements IMods {
|
|
11
|
-
abstract mods:
|
|
12
|
-
|
|
13
|
-
abstract container: HTMLElement;
|
|
14
|
-
abstract setMod(name: string, value: ModType): this;
|
|
15
|
-
abstract getMod(name: string): ModType;
|
|
11
|
+
abstract mods: IDictionary;
|
|
12
|
+
afterSetMod(name: string, value: ModType): void;
|
|
16
13
|
/**
|
|
17
14
|
* Set/remove BEM class modification
|
|
18
15
|
*
|
|
19
16
|
* @param value - if null, mod will be removed
|
|
20
17
|
*/
|
|
21
|
-
|
|
18
|
+
setMod<T extends IComponent & IContainer & IMods>(this: T, name: string, value: ModType, container?: HTMLElement): T;
|
|
22
19
|
/**
|
|
23
20
|
* Get BEM class modification value
|
|
24
21
|
*/
|
|
25
|
-
|
|
22
|
+
getMod(this: IMods, name: string): ModType;
|
|
26
23
|
}
|
|
@@ -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
|
+
/**
|
|
7
|
+
* [[include:plugins/tooltip/README.md]]
|
|
8
|
+
* @packageDocumentation
|
|
9
|
+
* @module plugins/tooltip
|
|
10
|
+
*/
|
|
11
|
+
import './tooltip.less';
|
|
12
|
+
import type { IViewBased } from 'jodit/types';
|
|
13
|
+
import { UIElement } from '../../element';
|
|
14
|
+
export declare class UITooltip extends UIElement {
|
|
15
|
+
private __isOpened;
|
|
16
|
+
className(): string;
|
|
17
|
+
protected constructor(view: IViewBased);
|
|
18
|
+
private __useCount;
|
|
19
|
+
/**
|
|
20
|
+
* Creates only one instance of the tooltip for the container
|
|
21
|
+
*/
|
|
22
|
+
static make(view: IViewBased): UITooltip;
|
|
23
|
+
private __delayShowTimeout;
|
|
24
|
+
private __delayOpen;
|
|
25
|
+
private __open;
|
|
26
|
+
private __setPosition;
|
|
27
|
+
private __close;
|
|
28
|
+
destruct(): void;
|
|
29
|
+
}
|
|
@@ -6,9 +6,11 @@
|
|
|
6
6
|
/**
|
|
7
7
|
* @module ui
|
|
8
8
|
*/
|
|
9
|
-
import type { IDictionary, IUIElement, IViewBased, Nullable
|
|
9
|
+
import type { IDictionary, IUIElement, IViewBased, Nullable } from 'jodit/types';
|
|
10
10
|
import { ViewComponent } from 'jodit/core/component';
|
|
11
11
|
import { Elms, Mods } from 'jodit/core/traits';
|
|
12
|
+
export interface UIElement extends Mods, Elms {
|
|
13
|
+
}
|
|
12
14
|
export declare abstract class UIElement<T extends IViewBased = IViewBased> extends ViewComponent<T> implements IUIElement, Mods, Elms {
|
|
13
15
|
container: HTMLElement;
|
|
14
16
|
name: string;
|
|
@@ -28,14 +30,6 @@ export declare abstract class UIElement<T extends IViewBased = IViewBased> exten
|
|
|
28
30
|
*/
|
|
29
31
|
static closestElement(node: Node, type: Function): Nullable<IUIElement>;
|
|
30
32
|
readonly mods: IDictionary<string | boolean | null>;
|
|
31
|
-
/** @see [[Mods.setMod]] */
|
|
32
|
-
setMod(name: string, value: ModType, container?: HTMLElement): this;
|
|
33
|
-
/** @see [[Mods.getMod]] */
|
|
34
|
-
getMod(name: string): ModType;
|
|
35
|
-
/** @see [[Elms.getElm]]*/
|
|
36
|
-
getElm(elementName: string): Nullable<HTMLElement>;
|
|
37
|
-
/** @see [[Elms.getElms]]*/
|
|
38
|
-
getElms(elementName: string): HTMLElement[];
|
|
39
33
|
/**
|
|
40
34
|
* Update UI from state
|
|
41
35
|
*/
|