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
package/src/plugins/index.ts
CHANGED
|
@@ -16,8 +16,7 @@ export { focus } from './focus/focus';
|
|
|
16
16
|
export { classSpan } from './class-span/class-span';
|
|
17
17
|
export { Backspace } from './keyboard/backspace/backspace';
|
|
18
18
|
export { bold } from './bold/bold';
|
|
19
|
-
export { cleanHtml } from './fix
|
|
20
|
-
export { WrapTextNodes } from './fix/wrap-text-nodes';
|
|
19
|
+
export { WrapNodes, cleanHtml } from './fix';
|
|
21
20
|
export {
|
|
22
21
|
copyFormat,
|
|
23
22
|
clipboard,
|
|
@@ -57,6 +56,7 @@ export { size, resizeHandler } from './size';
|
|
|
57
56
|
export { source } from './source';
|
|
58
57
|
export { stat } from './stat/stat';
|
|
59
58
|
export { sticky } from './sticky/sticky';
|
|
59
|
+
export { spellcheck } from './spellcheck/spellcheck';
|
|
60
60
|
export { symbols } from './symbols/symbols';
|
|
61
61
|
export * from './table';
|
|
62
62
|
export { tooltip } from './tooltip/tooltip';
|
|
@@ -9,13 +9,13 @@
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import type { IControlType, IJodit } from 'jodit/types';
|
|
12
|
-
import { attr } from '
|
|
12
|
+
import { attr } from 'jodit/core/helpers/utils';
|
|
13
13
|
|
|
14
14
|
export default [
|
|
15
15
|
{
|
|
16
16
|
name: 'eye',
|
|
17
17
|
tooltip: 'Open link',
|
|
18
|
-
exec: (editor: IJodit, current) => {
|
|
18
|
+
exec: (editor: IJodit, current): void => {
|
|
19
19
|
const href = attr(current as HTMLElement, 'href');
|
|
20
20
|
|
|
21
21
|
if (current && href) {
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
* @module plugins/inline-popup
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import type { Table } from '../../../../modules';
|
|
12
11
|
import type { IControlType } from 'jodit/types';
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
12
|
+
import type { Table } from 'jodit/modules/table/table';
|
|
13
|
+
import { isJoditObject, isString } from 'jodit/core/helpers/checker';
|
|
14
|
+
import { css } from 'jodit/core/helpers/utils/css';
|
|
15
|
+
import { ColorPickerWidget, TabsWidget } from 'jodit/modules/widget';
|
|
16
16
|
|
|
17
17
|
const cmd = (control: IControlType): string =>
|
|
18
18
|
control.args && isString(control.args[0])
|
|
@@ -34,7 +34,7 @@ export default [
|
|
|
34
34
|
return false;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
const makeColorPicker = (key: string) =>
|
|
37
|
+
const makeColorPicker = (key: string): HTMLElement =>
|
|
38
38
|
ColorPickerWidget(
|
|
39
39
|
editor,
|
|
40
40
|
(value: string) => {
|
|
@@ -43,7 +43,7 @@ export default [
|
|
|
43
43
|
});
|
|
44
44
|
|
|
45
45
|
editor.lock();
|
|
46
|
-
editor.
|
|
46
|
+
editor.synchronizeValues();
|
|
47
47
|
close();
|
|
48
48
|
editor.unlock();
|
|
49
49
|
},
|
|
@@ -64,8 +64,8 @@ export default [
|
|
|
64
64
|
{
|
|
65
65
|
name: 'valign',
|
|
66
66
|
list: ['Top', 'Middle', 'Bottom', 'Normal'],
|
|
67
|
-
childTemplate: (_, __, value: string) => value,
|
|
68
|
-
exec: (editor, table, { control }) => {
|
|
67
|
+
childTemplate: (_, __, value: string): string => value,
|
|
68
|
+
exec: (editor, table, { control }): void => {
|
|
69
69
|
const command = cmd(control);
|
|
70
70
|
|
|
71
71
|
editor
|
|
@@ -105,7 +105,7 @@ export default [
|
|
|
105
105
|
tableaddcolumnbefore: 'Insert column before',
|
|
106
106
|
tableaddcolumnafter: 'Insert column after'
|
|
107
107
|
},
|
|
108
|
-
exec: (editor, table, { control }) => {
|
|
108
|
+
exec: (editor, table, { control }): void => {
|
|
109
109
|
if (!isJoditObject(editor)) {
|
|
110
110
|
return;
|
|
111
111
|
}
|
|
@@ -122,7 +122,7 @@ export default [
|
|
|
122
122
|
tableaddrowbefore: 'Insert row above',
|
|
123
123
|
tableaddrowafter: 'Insert row below'
|
|
124
124
|
},
|
|
125
|
-
exec: (editor, table, { control }) => {
|
|
125
|
+
exec: (editor, table, { control }): void => {
|
|
126
126
|
if (!isJoditObject(editor)) {
|
|
127
127
|
return;
|
|
128
128
|
}
|
|
@@ -142,7 +142,7 @@ export default [
|
|
|
142
142
|
tablebincolumn: 'Delete column',
|
|
143
143
|
tableempty: 'Empty cell'
|
|
144
144
|
},
|
|
145
|
-
exec: (editor, table, { control }) => {
|
|
145
|
+
exec: (editor, table, { control }): void => {
|
|
146
146
|
if (!isJoditObject(editor)) {
|
|
147
147
|
return;
|
|
148
148
|
}
|
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import type { IControlType, IJodit } from 'jodit/types';
|
|
12
|
-
import { Dom } from '
|
|
13
|
-
import { isString } from '
|
|
14
|
-
import { css } from '
|
|
15
|
-
import { hAlignElement } from '
|
|
12
|
+
import { Dom } from 'jodit/core/dom';
|
|
13
|
+
import { isString } from 'jodit/core/helpers/checker/is-string';
|
|
14
|
+
import { css } from 'jodit/core/helpers/utils/css';
|
|
15
|
+
import { hAlignElement } from 'jodit/plugins/image/helpers';
|
|
16
16
|
|
|
17
17
|
export const align: IControlType<IJodit> = {
|
|
18
18
|
name: 'left',
|
|
@@ -38,7 +38,7 @@ export const align: IControlType<IJodit> = {
|
|
|
38
38
|
hAlignElement(elm.firstElementChild as HTMLElement, command);
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
editor.
|
|
41
|
+
editor.synchronizeValues();
|
|
42
42
|
|
|
43
43
|
editor.e.fire('recalcPositionPopup');
|
|
44
44
|
},
|
|
@@ -50,13 +50,13 @@ export default [
|
|
|
50
50
|
name: 'delete',
|
|
51
51
|
icon: 'bin',
|
|
52
52
|
tooltip: 'Delete',
|
|
53
|
-
exec: (editor: IJodit, image) => {
|
|
53
|
+
exec: (editor: IJodit, image): void => {
|
|
54
54
|
image && editor.s.removeNode(image);
|
|
55
55
|
}
|
|
56
56
|
},
|
|
57
57
|
{
|
|
58
58
|
name: 'pencil',
|
|
59
|
-
exec(editor: IJodit, current) {
|
|
59
|
+
exec(editor: IJodit, current): void {
|
|
60
60
|
const tagName = (current as HTMLElement).tagName.toLowerCase();
|
|
61
61
|
|
|
62
62
|
if (tagName === 'img') {
|
|
@@ -219,12 +219,12 @@ export class inlinePopup extends Plugin {
|
|
|
219
219
|
private snapRange: Nullable<Range> = null;
|
|
220
220
|
|
|
221
221
|
@autobind
|
|
222
|
-
private onSelectionStart() {
|
|
222
|
+
private onSelectionStart(): void {
|
|
223
223
|
this.snapRange = this.j.s.range.cloneRange();
|
|
224
224
|
}
|
|
225
225
|
|
|
226
226
|
@autobind
|
|
227
|
-
private onSelectionEnd(e: MouseEvent) {
|
|
227
|
+
private onSelectionEnd(e: MouseEvent): void {
|
|
228
228
|
if (
|
|
229
229
|
e &&
|
|
230
230
|
e.target &&
|
|
@@ -327,11 +327,11 @@ export class inlinePopup extends Plugin {
|
|
|
327
327
|
.join(' ');
|
|
328
328
|
}
|
|
329
329
|
|
|
330
|
-
private addListenersForElements() {
|
|
330
|
+
private addListenersForElements(): void {
|
|
331
331
|
this.j.e.on(this._eventsList(), this.onClick);
|
|
332
332
|
}
|
|
333
333
|
|
|
334
|
-
private removeListenersForElements() {
|
|
334
|
+
private removeListenersForElements(): void {
|
|
335
335
|
this.j.e.off(this._eventsList(), this.onClick);
|
|
336
336
|
}
|
|
337
337
|
|
|
@@ -339,7 +339,7 @@ export class inlinePopup extends Plugin {
|
|
|
339
339
|
* Show the inline WYSIWYG toolbar editor.
|
|
340
340
|
*/
|
|
341
341
|
@autobind
|
|
342
|
-
private showInlineToolbar(bound?: IBound) {
|
|
342
|
+
private showInlineToolbar(bound?: IBound): void {
|
|
343
343
|
this.showPopup(() => {
|
|
344
344
|
if (bound) {
|
|
345
345
|
return bound;
|
|
@@ -157,7 +157,7 @@ export class Backspace extends Plugin {
|
|
|
157
157
|
/**
|
|
158
158
|
* Remove node and replace cursor position out of it
|
|
159
159
|
*/
|
|
160
|
-
private safeRemoveEmptyNode(fakeNode: Node) {
|
|
160
|
+
private safeRemoveEmptyNode(fakeNode: Node): void {
|
|
161
161
|
const { range } = this.j.s;
|
|
162
162
|
|
|
163
163
|
if (range.startContainer === fakeNode) {
|
|
@@ -65,7 +65,7 @@ function checkMoveListContent(
|
|
|
65
65
|
// Process UL/LI/OL cases
|
|
66
66
|
const siblingIsList = Dom.isTag(sibling, ['ol', 'ul']);
|
|
67
67
|
const boxIsList = Dom.isTag(mainClosestBox, ['ol', 'ul']);
|
|
68
|
-
const elementChild = (elm: Element, side: boolean) =>
|
|
68
|
+
const elementChild = (elm: Element, side: boolean): Nullable<Node> =>
|
|
69
69
|
side ? elm.firstElementChild : elm.lastElementChild;
|
|
70
70
|
|
|
71
71
|
if (boxIsList) {
|
|
@@ -56,7 +56,7 @@ export function findMostNestedNeighbor(
|
|
|
56
56
|
root: HTMLElement,
|
|
57
57
|
onlyInlide: boolean = false
|
|
58
58
|
): Nullable<Node> {
|
|
59
|
-
const nextChild = (node: Node) =>
|
|
59
|
+
const nextChild = (node: Node): Nullable<Node> =>
|
|
60
60
|
right ? node.firstChild : node.lastChild;
|
|
61
61
|
|
|
62
62
|
let next = findNotEmptyNeighbor(node, !right, root);
|
|
@@ -56,7 +56,7 @@ export class limit extends Plugin {
|
|
|
56
56
|
jodit.e
|
|
57
57
|
.off('.limit')
|
|
58
58
|
.on('beforePaste.limit', () => {
|
|
59
|
-
snapshot = jodit.
|
|
59
|
+
snapshot = jodit.history.snapshot.make();
|
|
60
60
|
})
|
|
61
61
|
.on(
|
|
62
62
|
'keydown.limit keyup.limit beforeEnter.limit beforePaste.limit',
|
|
@@ -65,7 +65,7 @@ export class limit extends Plugin {
|
|
|
65
65
|
.on('change.limit', this.checkPreventChanging)
|
|
66
66
|
.on('afterPaste.limit', (): false | void => {
|
|
67
67
|
if (this.shouldPreventInsertHTML() && snapshot) {
|
|
68
|
-
jodit.
|
|
68
|
+
jodit.history.snapshot.restore(snapshot);
|
|
69
69
|
return false;
|
|
70
70
|
}
|
|
71
71
|
});
|
|
@@ -111,7 +111,7 @@ export class limit extends Plugin {
|
|
|
111
111
|
* Check if some external changing should be prevented
|
|
112
112
|
*/
|
|
113
113
|
@autobind
|
|
114
|
-
private checkPreventChanging(newValue: string, oldValue: string) {
|
|
114
|
+
private checkPreventChanging(newValue: string, oldValue: string): void {
|
|
115
115
|
const { jodit } = this;
|
|
116
116
|
const { limitWords, limitChars } = jodit.o;
|
|
117
117
|
|
|
@@ -35,7 +35,7 @@ export class lineHeight extends Plugin {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
@autobind
|
|
38
|
-
private applyLineHeight(ignore: string, ignoreA: any, value: any) {
|
|
38
|
+
private applyLineHeight(ignore: string, ignoreA: any, value: any): void {
|
|
39
39
|
const { s, createInside: c, editor: root, o } = this.j;
|
|
40
40
|
|
|
41
41
|
if (!s.isFocused()) {
|
package/src/plugins/link/link.ts
CHANGED
|
@@ -116,7 +116,7 @@ Config.prototype.controls.unlink = {
|
|
|
116
116
|
Dom.unwrap(anchor);
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
-
editor.
|
|
119
|
+
editor.synchronizeValues();
|
|
120
120
|
editor.e.fire('hidePopup');
|
|
121
121
|
},
|
|
122
122
|
tooltip: 'Unlink'
|
|
@@ -182,7 +182,7 @@ export class link extends Plugin {
|
|
|
182
182
|
}
|
|
183
183
|
|
|
184
184
|
@autobind
|
|
185
|
-
private onDblClickOnLink(e: MouseEvent) {
|
|
185
|
+
private onDblClickOnLink(e: MouseEvent): void {
|
|
186
186
|
if (!Dom.isTag(e.target, 'a')) {
|
|
187
187
|
return;
|
|
188
188
|
}
|
|
@@ -280,7 +280,7 @@ export class link extends Plugin {
|
|
|
280
280
|
|
|
281
281
|
let link: false | HTMLAnchorElement;
|
|
282
282
|
|
|
283
|
-
const getSelectionText = () =>
|
|
283
|
+
const getSelectionText = (): string =>
|
|
284
284
|
link
|
|
285
285
|
? link.innerText
|
|
286
286
|
: stripTags(jodit.s.range.cloneContents(), jodit.ed);
|
|
@@ -360,18 +360,18 @@ export class link extends Plugin {
|
|
|
360
360
|
}
|
|
361
361
|
|
|
362
362
|
jodit.editor.normalize();
|
|
363
|
-
const snapshot = jodit.
|
|
363
|
+
const snapshot = jodit.history.snapshot.make();
|
|
364
364
|
|
|
365
365
|
if (unlink) {
|
|
366
366
|
jodit.e.on(unlink, 'click', (e: MouseEvent) => {
|
|
367
367
|
jodit.s.restore();
|
|
368
|
-
jodit.
|
|
368
|
+
jodit.history.snapshot.restore(snapshot);
|
|
369
369
|
|
|
370
370
|
if (link) {
|
|
371
371
|
Dom.unwrap(link);
|
|
372
372
|
}
|
|
373
373
|
|
|
374
|
-
jodit.
|
|
374
|
+
jodit.synchronizeValues();
|
|
375
375
|
|
|
376
376
|
close();
|
|
377
377
|
e.preventDefault();
|
|
@@ -390,7 +390,7 @@ export class link extends Plugin {
|
|
|
390
390
|
jodit.s.restore();
|
|
391
391
|
jodit.s.removeMarkers();
|
|
392
392
|
jodit.editor.normalize();
|
|
393
|
-
jodit.
|
|
393
|
+
jodit.history.snapshot.restore(snapshot);
|
|
394
394
|
|
|
395
395
|
const textWasChanged =
|
|
396
396
|
getSelectionText() !== content_input.value.trim();
|
|
@@ -487,7 +487,7 @@ export class link extends Plugin {
|
|
|
487
487
|
}
|
|
488
488
|
});
|
|
489
489
|
|
|
490
|
-
jodit.
|
|
490
|
+
jodit.synchronizeValues();
|
|
491
491
|
|
|
492
492
|
close();
|
|
493
493
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* @module plugins/link
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import type { IJodit, IUIForm } from 'jodit/types';
|
|
11
|
+
import type { IJodit, IUIElement, IUIForm, Nullable } from 'jodit/types';
|
|
12
12
|
import {
|
|
13
13
|
UIBlock,
|
|
14
14
|
UICheckbox,
|
|
@@ -54,7 +54,7 @@ export const formTemplate = (editor: IJodit): IUIForm => {
|
|
|
54
54
|
),
|
|
55
55
|
modeClassName
|
|
56
56
|
? new UIBlock(editor, [
|
|
57
|
-
(() => {
|
|
57
|
+
((): Nullable<IUIElement> => {
|
|
58
58
|
if (modeClassName === 'input') {
|
|
59
59
|
return new UIInput(editor, {
|
|
60
60
|
name: 'className',
|
|
@@ -24,7 +24,7 @@ Config.prototype.controls.file = {
|
|
|
24
24
|
self: IControlType,
|
|
25
25
|
close
|
|
26
26
|
) => {
|
|
27
|
-
const insert = (url: string, title: string = '') => {
|
|
27
|
+
const insert = (url: string, title: string = ''): void => {
|
|
28
28
|
editor.s.insertNode(
|
|
29
29
|
editor.createInside.fromHTML(
|
|
30
30
|
`<a href="${url}" title="${title}">${title || url}</a>`
|
|
@@ -44,7 +44,7 @@ export function media(editor: IJodit): void {
|
|
|
44
44
|
|
|
45
45
|
const { mediaFakeTag, mediaBlocks, mediaInFakeBlock } = editor.options;
|
|
46
46
|
|
|
47
|
-
const wrap = (element: HTMLElement) => {
|
|
47
|
+
const wrap = (element: HTMLElement): void => {
|
|
48
48
|
if (
|
|
49
49
|
element.parentNode &&
|
|
50
50
|
attr(element.parentNode as HTMLElement, 'data-jodit_iframe_wrapper')
|
|
@@ -73,7 +73,7 @@ export function mobile(editor: IJodit): void {
|
|
|
73
73
|
editor.container.parentElement ?? editor.container
|
|
74
74
|
).offsetWidth;
|
|
75
75
|
|
|
76
|
-
const newStore = (() => {
|
|
76
|
+
const newStore = ((): ReturnType<typeof splitArray> => {
|
|
77
77
|
if (width >= editor.o.sizeLG) {
|
|
78
78
|
return splitArray(editor.o.buttons);
|
|
79
79
|
}
|
|
@@ -0,0 +1,61 @@
|
|
|
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/ordered-list
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { Config } from 'jodit/config';
|
|
12
|
+
import type { IControlType, IJodit } from 'jodit/types';
|
|
13
|
+
import { dataBind } from 'jodit/core/helpers/utils/data-bind';
|
|
14
|
+
|
|
15
|
+
const memoExec: IControlType<IJodit>['exec'] = (
|
|
16
|
+
jodit,
|
|
17
|
+
_,
|
|
18
|
+
{ control }
|
|
19
|
+
): void => {
|
|
20
|
+
const key = `button${control.command}`;
|
|
21
|
+
|
|
22
|
+
const value = (control.args && control.args[0]) ?? dataBind(jodit, key);
|
|
23
|
+
|
|
24
|
+
dataBind(jodit, key, value);
|
|
25
|
+
|
|
26
|
+
jodit.execCommand(
|
|
27
|
+
control.command as string,
|
|
28
|
+
false,
|
|
29
|
+
value === 'default' ? null : value
|
|
30
|
+
);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
Config.prototype.controls.ul = {
|
|
34
|
+
command: 'insertUnorderedList',
|
|
35
|
+
tags: ['ul'],
|
|
36
|
+
tooltip: 'Insert Unordered List',
|
|
37
|
+
|
|
38
|
+
list: {
|
|
39
|
+
default: 'Default',
|
|
40
|
+
circle: 'Circle',
|
|
41
|
+
disc: 'Dot',
|
|
42
|
+
square: 'Quadrate'
|
|
43
|
+
},
|
|
44
|
+
exec: memoExec
|
|
45
|
+
} as IControlType;
|
|
46
|
+
|
|
47
|
+
Config.prototype.controls.ol = {
|
|
48
|
+
command: 'insertOrderedList',
|
|
49
|
+
tags: ['ol'],
|
|
50
|
+
tooltip: 'Insert Ordered List',
|
|
51
|
+
|
|
52
|
+
list: {
|
|
53
|
+
default: 'Default',
|
|
54
|
+
'lower-alpha': 'Lower Alpha',
|
|
55
|
+
'lower-greek': 'Lower Greek',
|
|
56
|
+
'lower-roman': 'Lower Roman',
|
|
57
|
+
'upper-alpha': 'Upper Alpha',
|
|
58
|
+
'upper-roman': 'Upper Roman'
|
|
59
|
+
},
|
|
60
|
+
exec: memoExec
|
|
61
|
+
} as IControlType;
|
|
@@ -8,56 +8,11 @@
|
|
|
8
8
|
* @module plugins/ordered-list
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import type {
|
|
12
|
-
import { Config } from 'jodit/config';
|
|
13
|
-
import { Dom } from 'jodit/core/dom';
|
|
14
|
-
import { dataBind, toArray } from 'jodit/core/helpers';
|
|
11
|
+
import type { IJodit } from 'jodit/types';
|
|
15
12
|
import { Plugin } from 'jodit/core/plugin';
|
|
16
13
|
import { autobind } from 'jodit/core/decorators';
|
|
17
14
|
|
|
18
|
-
|
|
19
|
-
jodit,
|
|
20
|
-
_,
|
|
21
|
-
{ control }
|
|
22
|
-
): void => {
|
|
23
|
-
const key = `button${control.command}`;
|
|
24
|
-
|
|
25
|
-
const value = (control.args && control.args[0]) || dataBind(jodit, key);
|
|
26
|
-
|
|
27
|
-
dataBind(jodit, key, value);
|
|
28
|
-
|
|
29
|
-
jodit.execCommand(control.command as string, false, value);
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
Config.prototype.controls.ul = {
|
|
33
|
-
command: 'insertUnorderedList',
|
|
34
|
-
tags: ['ul'],
|
|
35
|
-
tooltip: 'Insert Unordered List',
|
|
36
|
-
|
|
37
|
-
list: {
|
|
38
|
-
default: 'Default',
|
|
39
|
-
circle: 'Circle',
|
|
40
|
-
disc: 'Dot',
|
|
41
|
-
square: 'Quadrate'
|
|
42
|
-
},
|
|
43
|
-
exec: memoExec
|
|
44
|
-
} as IControlType;
|
|
45
|
-
|
|
46
|
-
Config.prototype.controls.ol = {
|
|
47
|
-
command: 'insertOrderedList',
|
|
48
|
-
tags: ['ol'],
|
|
49
|
-
tooltip: 'Insert Ordered List',
|
|
50
|
-
|
|
51
|
-
list: {
|
|
52
|
-
default: 'Default',
|
|
53
|
-
'lower-alpha': 'Lower Alpha',
|
|
54
|
-
'lower-greek': 'Lower Greek',
|
|
55
|
-
'lower-roman': 'Lower Roman',
|
|
56
|
-
'upper-alpha': 'Upper Alpha',
|
|
57
|
-
'upper-roman': 'Upper Roman'
|
|
58
|
-
},
|
|
59
|
-
exec: memoExec
|
|
60
|
-
} as IControlType;
|
|
15
|
+
import './config';
|
|
61
16
|
|
|
62
17
|
/**
|
|
63
18
|
* Process commands insertOrderedList and insertUnOrderedList
|
|
@@ -91,115 +46,10 @@ export class orderedList extends Plugin {
|
|
|
91
46
|
}
|
|
92
47
|
);
|
|
93
48
|
|
|
94
|
-
this.jodit.
|
|
49
|
+
this.jodit.synchronizeValues();
|
|
95
50
|
|
|
96
51
|
return false;
|
|
97
52
|
}
|
|
98
53
|
|
|
99
54
|
protected beforeDestruct(jodit: IJodit): void {}
|
|
100
55
|
}
|
|
101
|
-
|
|
102
|
-
export function orderedList1(editor: IJodit): void {
|
|
103
|
-
const isOurCommand = (command: string) =>
|
|
104
|
-
/insert(un)?orderedlist/i.test(command),
|
|
105
|
-
getListWrapper = () =>
|
|
106
|
-
Dom.up(
|
|
107
|
-
editor.s.current() as Node,
|
|
108
|
-
(tag: Node | null) => tag && /^UL|OL$/i.test(tag.nodeName),
|
|
109
|
-
editor.editor
|
|
110
|
-
),
|
|
111
|
-
listStyleTypeEqual = (el: HTMLElement, listStyleType: string) => {
|
|
112
|
-
const value = el.style.listStyleType;
|
|
113
|
-
|
|
114
|
-
return (
|
|
115
|
-
value === listStyleType ||
|
|
116
|
-
(!value && listStyleType === 'default')
|
|
117
|
-
);
|
|
118
|
-
},
|
|
119
|
-
setListStyleType = (el: HTMLElement, value: string) => {
|
|
120
|
-
if (value === 'default' || !value) {
|
|
121
|
-
el.style.removeProperty('list-style-type');
|
|
122
|
-
} else {
|
|
123
|
-
el.style.setProperty('list-style-type', value);
|
|
124
|
-
}
|
|
125
|
-
};
|
|
126
|
-
|
|
127
|
-
editor.e
|
|
128
|
-
.on(
|
|
129
|
-
'beforeCommand',
|
|
130
|
-
(command: string, _, listStyleType: string): false | void => {
|
|
131
|
-
if (isOurCommand(command) && listStyleType) {
|
|
132
|
-
const ul = getListWrapper();
|
|
133
|
-
|
|
134
|
-
if (ul && !listStyleTypeEqual(ul, listStyleType)) {
|
|
135
|
-
if (
|
|
136
|
-
(Dom.isTag(ul, 'ul') &&
|
|
137
|
-
/unordered/i.test(command)) ||
|
|
138
|
-
(Dom.isTag(ul, 'ol') && !/unordered/i.test(command))
|
|
139
|
-
) {
|
|
140
|
-
setListStyleType(ul, listStyleType);
|
|
141
|
-
return false;
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
)
|
|
147
|
-
.on(
|
|
148
|
-
'afterCommand',
|
|
149
|
-
(command: string, _, listStyleType: string): false | void => {
|
|
150
|
-
if (isOurCommand(command)) {
|
|
151
|
-
const ul = getListWrapper();
|
|
152
|
-
|
|
153
|
-
if (ul) {
|
|
154
|
-
setListStyleType(ul, listStyleType);
|
|
155
|
-
editor.createInside.applyCreateAttributes(ul);
|
|
156
|
-
|
|
157
|
-
ul.querySelectorAll('li').forEach(li => {
|
|
158
|
-
editor.createInside.applyCreateAttributes(li);
|
|
159
|
-
});
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
const unwrapList: Node[] = [],
|
|
163
|
-
shouldUnwrap = (elm: Nullable<Node>): void => {
|
|
164
|
-
if (
|
|
165
|
-
Dom.isTag(elm, [
|
|
166
|
-
'p',
|
|
167
|
-
'h1',
|
|
168
|
-
'h2',
|
|
169
|
-
'h3',
|
|
170
|
-
'h4',
|
|
171
|
-
'h5',
|
|
172
|
-
'h6'
|
|
173
|
-
])
|
|
174
|
-
) {
|
|
175
|
-
unwrapList.push(elm);
|
|
176
|
-
}
|
|
177
|
-
};
|
|
178
|
-
|
|
179
|
-
if (ul) {
|
|
180
|
-
shouldUnwrap(ul.parentNode);
|
|
181
|
-
|
|
182
|
-
ul.querySelectorAll('li').forEach(li =>
|
|
183
|
-
shouldUnwrap(li.firstChild)
|
|
184
|
-
);
|
|
185
|
-
|
|
186
|
-
if (unwrapList.length) {
|
|
187
|
-
editor.s.save();
|
|
188
|
-
|
|
189
|
-
toArray(ul.childNodes).forEach(li => {
|
|
190
|
-
if (Dom.isTag(li.lastChild, 'br')) {
|
|
191
|
-
Dom.safeRemove(li.lastChild);
|
|
192
|
-
}
|
|
193
|
-
});
|
|
194
|
-
|
|
195
|
-
unwrapList.forEach(elm => Dom.unwrap(elm));
|
|
196
|
-
|
|
197
|
-
editor.s.restore();
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
editor.setEditorValue();
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
);
|
|
205
|
-
}
|
|
@@ -94,7 +94,7 @@ export class placeholder extends Plugin {
|
|
|
94
94
|
this.addEvents();
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
private addNativeListeners = () => {
|
|
97
|
+
private addNativeListeners = (): void => {
|
|
98
98
|
this.j.e
|
|
99
99
|
.off(this.j.editor, 'input.placeholder keydown.placeholder')
|
|
100
100
|
.on(
|
|
@@ -104,7 +104,7 @@ export class placeholder extends Plugin {
|
|
|
104
104
|
);
|
|
105
105
|
};
|
|
106
106
|
|
|
107
|
-
private addEvents = () => {
|
|
107
|
+
private addEvents = (): void => {
|
|
108
108
|
const editor = this.j;
|
|
109
109
|
|
|
110
110
|
if (
|
|
@@ -191,7 +191,7 @@ export class placeholder extends Plugin {
|
|
|
191
191
|
}
|
|
192
192
|
|
|
193
193
|
@debounce(ctx => ctx.defaultTimeout / 10, true)
|
|
194
|
-
private toggle() {
|
|
194
|
+
private toggle(): void {
|
|
195
195
|
const editor = this.j;
|
|
196
196
|
|
|
197
197
|
if (!editor.editor || editor.isInDestruct) {
|