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,159 @@
|
|
|
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
|
+
@import (reference) '../../../styles/variables';
|
|
8
|
+
|
|
9
|
+
:root {
|
|
10
|
+
--height-search: 30px;
|
|
11
|
+
--width-search: 320px;
|
|
12
|
+
--width-search-input-box: 60%;
|
|
13
|
+
--width-search-count-box: 15%;
|
|
14
|
+
--transform-button-active: 0.95;
|
|
15
|
+
--timeout-button-active: 0.1s;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.jodit-ui-search {
|
|
19
|
+
position: absolute;
|
|
20
|
+
top: 0;
|
|
21
|
+
right: 0;
|
|
22
|
+
width: 0;
|
|
23
|
+
height: 0;
|
|
24
|
+
|
|
25
|
+
&_sticky_true {
|
|
26
|
+
position: fixed;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
&__box {
|
|
30
|
+
position: absolute;
|
|
31
|
+
right: 0;
|
|
32
|
+
|
|
33
|
+
display: flex;
|
|
34
|
+
|
|
35
|
+
width: var(--width-search);
|
|
36
|
+
max-width: 100vw;
|
|
37
|
+
padding: calc(var(--padding-default) / 2);
|
|
38
|
+
|
|
39
|
+
border: solid var(--color-border);
|
|
40
|
+
border-width: 0 0 1px 1px;
|
|
41
|
+
background-color: var(--color-panel);
|
|
42
|
+
|
|
43
|
+
input {
|
|
44
|
+
width: 100%;
|
|
45
|
+
height: 100%;
|
|
46
|
+
padding: 0 var(--padding-default);
|
|
47
|
+
border: 0;
|
|
48
|
+
margin: 0;
|
|
49
|
+
background-color: transparent;
|
|
50
|
+
outline: none;
|
|
51
|
+
|
|
52
|
+
&[data-ref='replace'] {
|
|
53
|
+
display: none;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
input:not(:focus) + input:not(:focus) {
|
|
58
|
+
border-top: 1px solid var(--color-border);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
&__buttons,
|
|
63
|
+
&__counts,
|
|
64
|
+
&__inputs {
|
|
65
|
+
height: var(--height-search);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
&__inputs {
|
|
69
|
+
width: var(--width-search-input-box);
|
|
70
|
+
padding-right: calc(var(--padding-default) / 2);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
&__counts {
|
|
74
|
+
display: flex;
|
|
75
|
+
width: var(--width-search-count-box);
|
|
76
|
+
align-items: center;
|
|
77
|
+
justify-content: center;
|
|
78
|
+
border-left: 1px solid var(--color-border);
|
|
79
|
+
color: var(--color-border);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
&__buttons {
|
|
83
|
+
display: flex;
|
|
84
|
+
flex: 1;
|
|
85
|
+
align-items: center;
|
|
86
|
+
justify-content: center;
|
|
87
|
+
padding-left: 0;
|
|
88
|
+
|
|
89
|
+
button {
|
|
90
|
+
width: 32%;
|
|
91
|
+
height: 100%;
|
|
92
|
+
border: 1px solid transparent;
|
|
93
|
+
margin-right: 1%;
|
|
94
|
+
background-color: transparent;
|
|
95
|
+
|
|
96
|
+
&[data-ref='replace-btn'] {
|
|
97
|
+
display: none;
|
|
98
|
+
width: 100%;
|
|
99
|
+
border: 1px solid var(--color-border);
|
|
100
|
+
margin-top: 2px;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
&:hover {
|
|
104
|
+
background-color: var(--color-background-button-hover);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
&:focus {
|
|
108
|
+
border: 1px solid var(--color-background-selection_opacity50);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
&:active {
|
|
112
|
+
border: 1px solid var(--color-background-selection);
|
|
113
|
+
transform: scale(
|
|
114
|
+
var(--transform-button-active),
|
|
115
|
+
var(--transform-button-active)
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
&_empty-query_true {
|
|
122
|
+
[data-ref='next'],
|
|
123
|
+
[data-ref='prev'] {
|
|
124
|
+
opacity: 0.5;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
&_replace_true {
|
|
129
|
+
.jodit-ui-search__counts,
|
|
130
|
+
.jodit-ui-search__inputs {
|
|
131
|
+
height: calc(var(--height-search) * 2);
|
|
132
|
+
|
|
133
|
+
input {
|
|
134
|
+
height: 50%;
|
|
135
|
+
transition: background-color var(--timeout-button-active) linear;
|
|
136
|
+
|
|
137
|
+
&:focus {
|
|
138
|
+
box-shadow: inset 0 0 3px 0 var(--color-border);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
&[data-ref='replace'] {
|
|
142
|
+
display: block;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.jodit-ui-search__buttons {
|
|
148
|
+
flex-wrap: wrap;
|
|
149
|
+
|
|
150
|
+
button[data-ref='replace-btn'] {
|
|
151
|
+
display: block;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
[jd-tmp-selection] {
|
|
158
|
+
background-color: aquamarine;
|
|
159
|
+
}
|
|
@@ -0,0 +1,256 @@
|
|
|
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/search
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import './search.less';
|
|
12
|
+
|
|
13
|
+
import type { IJodit, MarkerInfo, Nullable } from 'jodit/types';
|
|
14
|
+
import { Icon, UIElement } from 'jodit/core/ui';
|
|
15
|
+
import { css, position, refs, trim } from 'jodit/core/helpers';
|
|
16
|
+
import { MODE_WYSIWYG } from 'jodit/core/constants';
|
|
17
|
+
import * as consts from 'jodit/core/constants';
|
|
18
|
+
import { autobind, component, watch } from 'jodit/core/decorators';
|
|
19
|
+
import { Dom } from 'jodit/core/dom';
|
|
20
|
+
|
|
21
|
+
@component
|
|
22
|
+
export class UISearch extends UIElement<IJodit> {
|
|
23
|
+
override className(): string {
|
|
24
|
+
return 'UISearch';
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
private queryInput: HTMLInputElement;
|
|
28
|
+
private replaceInput: HTMLInputElement;
|
|
29
|
+
selInfo: Nullable<MarkerInfo[]> = null;
|
|
30
|
+
|
|
31
|
+
private closeButton: HTMLButtonElement;
|
|
32
|
+
private replaceButton: HTMLButtonElement;
|
|
33
|
+
private currentBox: HTMLSpanElement;
|
|
34
|
+
private countBox: HTMLSpanElement;
|
|
35
|
+
|
|
36
|
+
override render(): string {
|
|
37
|
+
return `<div>
|
|
38
|
+
<div class="&__box">
|
|
39
|
+
<div class="&__inputs">
|
|
40
|
+
<input data-ref="query" tabindex="0" placeholder="~Search for~" type="text"/>
|
|
41
|
+
<input data-ref="replace" tabindex="0" placeholder="~Replace with~" type="text"/>
|
|
42
|
+
</div>
|
|
43
|
+
<div class="&__counts">
|
|
44
|
+
<span data-ref="counter-box">
|
|
45
|
+
<span data-ref="current">0</span><span>/</span><span data-ref="count">0</span>
|
|
46
|
+
</span>
|
|
47
|
+
</div>
|
|
48
|
+
<div class="&__buttons">
|
|
49
|
+
<button data-ref="next" tabindex="0" type="button">${Icon.get(
|
|
50
|
+
'angle-down'
|
|
51
|
+
)}</button>
|
|
52
|
+
<button data-ref="prev" tabindex="0" type="button">${Icon.get(
|
|
53
|
+
'angle-up'
|
|
54
|
+
)}</button>
|
|
55
|
+
<button data-ref="cancel" tabindex="0" type="button">${Icon.get(
|
|
56
|
+
'cancel'
|
|
57
|
+
)}</button>
|
|
58
|
+
<button data-ref="replace-btn" tabindex="0" type="button" class="jodit-ui-button">~Replace~</button>
|
|
59
|
+
</div>
|
|
60
|
+
</div>
|
|
61
|
+
</div>`;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
private _currentIndex: number = 0;
|
|
65
|
+
|
|
66
|
+
get currentIndex(): number {
|
|
67
|
+
return this._currentIndex;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
set currentIndex(value: number) {
|
|
71
|
+
this._currentIndex = value;
|
|
72
|
+
this.currentBox.innerText = value.toString();
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
set count(value: number) {
|
|
76
|
+
this.countBox.innerText = value.toString();
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
get query(): string {
|
|
80
|
+
return this.queryInput.value;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
get replace(): string {
|
|
84
|
+
return this.replaceInput.value;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
constructor(jodit: IJodit) {
|
|
88
|
+
super(jodit);
|
|
89
|
+
|
|
90
|
+
const {
|
|
91
|
+
query,
|
|
92
|
+
replace,
|
|
93
|
+
cancel,
|
|
94
|
+
next,
|
|
95
|
+
prev,
|
|
96
|
+
replaceBtn,
|
|
97
|
+
current,
|
|
98
|
+
count
|
|
99
|
+
} = refs(this.container);
|
|
100
|
+
|
|
101
|
+
this.queryInput = query as HTMLInputElement;
|
|
102
|
+
this.replaceInput = replace as HTMLInputElement;
|
|
103
|
+
this.closeButton = cancel as HTMLButtonElement;
|
|
104
|
+
this.replaceButton = replaceBtn as HTMLButtonElement;
|
|
105
|
+
|
|
106
|
+
this.currentBox = current as HTMLSpanElement;
|
|
107
|
+
this.countBox = count as HTMLSpanElement;
|
|
108
|
+
|
|
109
|
+
jodit.e
|
|
110
|
+
.on(this.closeButton, 'pointerdown', () => {
|
|
111
|
+
this.close();
|
|
112
|
+
return false;
|
|
113
|
+
})
|
|
114
|
+
.on(this.queryInput, 'input', () => {
|
|
115
|
+
this.currentIndex = 0;
|
|
116
|
+
})
|
|
117
|
+
.on(this.queryInput, 'pointerdown', () => {
|
|
118
|
+
if (jodit.s.isFocused()) {
|
|
119
|
+
jodit.s.removeMarkers();
|
|
120
|
+
this.selInfo = jodit.s.save();
|
|
121
|
+
}
|
|
122
|
+
})
|
|
123
|
+
.on(this.replaceButton, 'pointerdown', () => {
|
|
124
|
+
jodit.e.fire(this, 'pressReplaceButton');
|
|
125
|
+
return false;
|
|
126
|
+
})
|
|
127
|
+
.on(next, 'pointerdown', (): false => {
|
|
128
|
+
jodit.e.fire('searchNext');
|
|
129
|
+
return false;
|
|
130
|
+
})
|
|
131
|
+
.on(prev, 'pointerdown', (): false => {
|
|
132
|
+
jodit.e.fire('searchPrevious');
|
|
133
|
+
return false;
|
|
134
|
+
})
|
|
135
|
+
.on(this.queryInput, 'input', () => {
|
|
136
|
+
this.setMod('empty-query', !trim(this.queryInput.value).length);
|
|
137
|
+
})
|
|
138
|
+
.on(
|
|
139
|
+
this.queryInput,
|
|
140
|
+
'keydown',
|
|
141
|
+
this.j.async.debounce((e: KeyboardEvent) => {
|
|
142
|
+
switch (e.key) {
|
|
143
|
+
case consts.KEY_ENTER:
|
|
144
|
+
e.preventDefault();
|
|
145
|
+
e.stopImmediatePropagation();
|
|
146
|
+
if (jodit.e.fire('searchNext')) {
|
|
147
|
+
this.close();
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
break;
|
|
151
|
+
|
|
152
|
+
default:
|
|
153
|
+
jodit.e.fire(this, 'needUpdateCounters');
|
|
154
|
+
break;
|
|
155
|
+
}
|
|
156
|
+
}, this.j.defaultTimeout)
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
@watch([':keydown', 'queryInput:keydown'])
|
|
161
|
+
protected onEditorKeyDown(e: KeyboardEvent): void {
|
|
162
|
+
if (!this.isOpened) {
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
const { j } = this;
|
|
167
|
+
if (j.getRealMode() !== MODE_WYSIWYG) {
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
switch (e.key) {
|
|
172
|
+
case consts.KEY_ESC:
|
|
173
|
+
this.close();
|
|
174
|
+
break;
|
|
175
|
+
|
|
176
|
+
case consts.KEY_F3:
|
|
177
|
+
if (this.queryInput.value) {
|
|
178
|
+
j.e.fire(!e.shiftKey ? 'searchNext' : 'searchPrevious');
|
|
179
|
+
e.preventDefault();
|
|
180
|
+
}
|
|
181
|
+
break;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
isOpened: boolean = false;
|
|
186
|
+
|
|
187
|
+
@autobind
|
|
188
|
+
open(searchAndReplace: boolean = false): void {
|
|
189
|
+
if (!this.isOpened) {
|
|
190
|
+
this.j.workplace.appendChild(this.container);
|
|
191
|
+
this.isOpened = true;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
this.calcSticky(this.j.e.fire('getStickyState.sticky') || false);
|
|
195
|
+
|
|
196
|
+
this.j.e.fire('hidePopup');
|
|
197
|
+
|
|
198
|
+
this.setMod('replace', searchAndReplace);
|
|
199
|
+
|
|
200
|
+
// this.current = this.j.s.current();
|
|
201
|
+
|
|
202
|
+
const selStr: string = (this.j.s.sel || '').toString();
|
|
203
|
+
|
|
204
|
+
if (selStr) {
|
|
205
|
+
this.queryInput.value = selStr;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
this.setMod('empty-query', !selStr.length);
|
|
209
|
+
|
|
210
|
+
this.j.e.fire(this, 'needUpdateCounters');
|
|
211
|
+
|
|
212
|
+
if (selStr) {
|
|
213
|
+
this.queryInput.select();
|
|
214
|
+
} else {
|
|
215
|
+
this.queryInput.focus();
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
@autobind
|
|
220
|
+
close(): void {
|
|
221
|
+
if (!this.isOpened) {
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
this.j.s.restore();
|
|
226
|
+
|
|
227
|
+
Dom.safeRemove(this.container);
|
|
228
|
+
this.isOpened = false;
|
|
229
|
+
|
|
230
|
+
this.j.e.fire(this, 'afterClose');
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Calculate position if sticky is enabled
|
|
235
|
+
*/
|
|
236
|
+
@watch(':toggleSticky')
|
|
237
|
+
private calcSticky(enabled: boolean): void {
|
|
238
|
+
if (this.isOpened) {
|
|
239
|
+
this.setMod('sticky', enabled);
|
|
240
|
+
|
|
241
|
+
if (enabled) {
|
|
242
|
+
const pos = position(this.j.toolbarContainer);
|
|
243
|
+
|
|
244
|
+
css(this.container, {
|
|
245
|
+
top: pos.top + pos.height,
|
|
246
|
+
left: pos.left + pos.width
|
|
247
|
+
});
|
|
248
|
+
} else {
|
|
249
|
+
css(this.container, {
|
|
250
|
+
top: null,
|
|
251
|
+
left: null
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
@@ -31,19 +31,19 @@ declare module 'jodit/config' {
|
|
|
31
31
|
*
|
|
32
32
|
* @example
|
|
33
33
|
* ```javascript
|
|
34
|
-
*
|
|
34
|
+
* Jodit.make('.editor', {
|
|
35
35
|
* width: '100%',
|
|
36
36
|
* })
|
|
37
37
|
* ```
|
|
38
38
|
* @example
|
|
39
39
|
* ```javascript
|
|
40
|
-
*
|
|
40
|
+
* Jodit.make('.editor', {
|
|
41
41
|
* width: 600, // equivalent for '600px'
|
|
42
42
|
* })
|
|
43
43
|
* ```
|
|
44
44
|
* @example
|
|
45
45
|
* ```javascript
|
|
46
|
-
*
|
|
46
|
+
* Jodit.make('.editor', {
|
|
47
47
|
* width: 'auto', // autosize
|
|
48
48
|
* })
|
|
49
49
|
* ```
|
|
@@ -61,19 +61,19 @@ Config.prototype.allowResizeY = true;
|
|
|
61
61
|
*
|
|
62
62
|
* @example
|
|
63
63
|
* ```javascript
|
|
64
|
-
*
|
|
64
|
+
* Jodit.make('.editor', {
|
|
65
65
|
* height: '100%',
|
|
66
66
|
* })
|
|
67
67
|
* ```
|
|
68
68
|
* @example
|
|
69
69
|
* ```javascript
|
|
70
|
-
*
|
|
70
|
+
* Jodit.make('.editor', {
|
|
71
71
|
* height: 600, // equivalent for '600px'
|
|
72
72
|
* })
|
|
73
73
|
* ```
|
|
74
74
|
* @example
|
|
75
75
|
* ```javascript
|
|
76
|
-
*
|
|
76
|
+
* Jodit.make('.editor', {
|
|
77
77
|
* height: 'auto', // default - autosize
|
|
78
78
|
* })
|
|
79
79
|
* ```
|
|
@@ -85,13 +85,13 @@ Config.prototype.height = 'auto';
|
|
|
85
85
|
*
|
|
86
86
|
* @example
|
|
87
87
|
* ```javascript
|
|
88
|
-
*
|
|
88
|
+
* Jodit.make('.editor', {
|
|
89
89
|
* minHeight: '30%' //min-height: 30%
|
|
90
90
|
* })
|
|
91
91
|
* ```
|
|
92
92
|
* @example
|
|
93
93
|
* ```javascript
|
|
94
|
-
*
|
|
94
|
+
* Jodit.make('.editor', {
|
|
95
95
|
* minHeight: 200 //min-height: 200px
|
|
96
96
|
* })
|
|
97
97
|
* ```
|
|
@@ -69,7 +69,7 @@ export class resizeHandler extends Plugin {
|
|
|
69
69
|
/**
|
|
70
70
|
* Handler: Click on handle - start resizing
|
|
71
71
|
*/
|
|
72
|
-
private onHandleResizeStart(e: MouseEvent) {
|
|
72
|
+
private onHandleResizeStart(e: MouseEvent): void {
|
|
73
73
|
this.isResized = true;
|
|
74
74
|
|
|
75
75
|
this.start.x = e.clientX;
|
|
@@ -87,7 +87,7 @@ export class resizeHandler extends Plugin {
|
|
|
87
87
|
/**
|
|
88
88
|
* Handler: Mouse move after start resizing
|
|
89
89
|
*/
|
|
90
|
-
private onHandleResize(e: MouseEvent) {
|
|
90
|
+
private onHandleResize(e: MouseEvent): void {
|
|
91
91
|
if (!this.isResized) {
|
|
92
92
|
return;
|
|
93
93
|
}
|
|
@@ -106,7 +106,7 @@ export class resizeHandler extends Plugin {
|
|
|
106
106
|
/**
|
|
107
107
|
* End of resizing
|
|
108
108
|
*/
|
|
109
|
-
private onHandleResizeEnd() {
|
|
109
|
+
private onHandleResizeEnd(): void {
|
|
110
110
|
if (this.isResized) {
|
|
111
111
|
this.isResized = false;
|
|
112
112
|
|
package/src/plugins/size/size.ts
CHANGED
|
@@ -47,7 +47,7 @@ export class size extends Plugin {
|
|
|
47
47
|
/**
|
|
48
48
|
* Set editor size by options
|
|
49
49
|
*/
|
|
50
|
-
private initialize() {
|
|
50
|
+
private initialize(): void {
|
|
51
51
|
const { j } = this;
|
|
52
52
|
|
|
53
53
|
if (j.o.inline) {
|
|
@@ -82,7 +82,7 @@ export class size extends Plugin {
|
|
|
82
82
|
/**
|
|
83
83
|
* Manually change height
|
|
84
84
|
*/
|
|
85
|
-
private setHeight(height: number | string) {
|
|
85
|
+
private setHeight(height: number | string): void {
|
|
86
86
|
if (isNumber(height)) {
|
|
87
87
|
const { minHeight, maxHeight } = this.j.o;
|
|
88
88
|
|
|
@@ -107,7 +107,7 @@ export class size extends Plugin {
|
|
|
107
107
|
/**
|
|
108
108
|
* Manually change width
|
|
109
109
|
*/
|
|
110
|
-
private setWidth(width: number | string) {
|
|
110
|
+
private setWidth(width: number | string): void {
|
|
111
111
|
if (isNumber(width)) {
|
|
112
112
|
const { minWidth, maxWidth } = this.j.o;
|
|
113
113
|
|
|
@@ -140,7 +140,7 @@ export class size extends Plugin {
|
|
|
140
140
|
* Calculate workspace height
|
|
141
141
|
*/
|
|
142
142
|
@autobind
|
|
143
|
-
private resizeWorkspaceImd() {
|
|
143
|
+
private resizeWorkspaceImd(): void {
|
|
144
144
|
if (!this.j || this.j.isDestructed || !this.j.o || this.j.o.inline) {
|
|
145
145
|
return;
|
|
146
146
|
}
|
|
@@ -19,22 +19,22 @@ export class AceEditor
|
|
|
19
19
|
{
|
|
20
20
|
override className = 'jodit_ace_editor';
|
|
21
21
|
|
|
22
|
-
private aceExists() {
|
|
22
|
+
private aceExists(): boolean {
|
|
23
23
|
return (this.j.ow as any).ace !== undefined;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
27
|
* Proxy Method
|
|
28
28
|
*/
|
|
29
|
-
private proxyOnBlur = (e: MouseEvent) => {
|
|
29
|
+
private proxyOnBlur = (e: MouseEvent): void => {
|
|
30
30
|
this.j.e.fire('blur', e);
|
|
31
31
|
};
|
|
32
32
|
|
|
33
|
-
private proxyOnFocus = (e: MouseEvent) => {
|
|
33
|
+
private proxyOnFocus = (e: MouseEvent): void => {
|
|
34
34
|
this.j.e.fire('focus', e);
|
|
35
35
|
};
|
|
36
36
|
|
|
37
|
-
private proxyOnMouseDown = (e: MouseEvent) => {
|
|
37
|
+
private proxyOnMouseDown = (e: MouseEvent): void => {
|
|
38
38
|
this.j.e.fire('mousedown', e);
|
|
39
39
|
};
|
|
40
40
|
|
|
@@ -84,7 +84,7 @@ export class AceEditor
|
|
|
84
84
|
return { row, column };
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
private setSelectionRangeIndices(start: number, end: number) {
|
|
87
|
+
private setSelectionRangeIndices(start: number, end: number): void {
|
|
88
88
|
const startRowColumn = this.getRowColumnIndices(start);
|
|
89
89
|
const endRowColumn = this.getRowColumnIndices(end);
|
|
90
90
|
|
|
@@ -101,7 +101,7 @@ export class AceEditor
|
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
init(editor: IJodit): any {
|
|
104
|
-
const tryInitAceEditor = () => {
|
|
104
|
+
const tryInitAceEditor = (): void => {
|
|
105
105
|
if (this.instance !== undefined || !this.aceExists()) {
|
|
106
106
|
return;
|
|
107
107
|
}
|
|
@@ -270,13 +270,13 @@ export class AceEditor
|
|
|
270
270
|
}
|
|
271
271
|
|
|
272
272
|
replaceUndoManager(): void {
|
|
273
|
-
const {
|
|
273
|
+
const { history } = this.jodit;
|
|
274
274
|
|
|
275
275
|
this.instance.commands.addCommand({
|
|
276
276
|
name: 'Undo',
|
|
277
277
|
bindKey: { win: 'Ctrl-Z', mac: 'Command-Z' },
|
|
278
278
|
exec: () => {
|
|
279
|
-
|
|
279
|
+
history.undo();
|
|
280
280
|
}
|
|
281
281
|
});
|
|
282
282
|
|
|
@@ -284,7 +284,7 @@ export class AceEditor
|
|
|
284
284
|
name: 'Redo',
|
|
285
285
|
bindKey: { win: 'Ctrl-Shift-Z', mac: 'Command-Shift-Z' },
|
|
286
286
|
exec: () => {
|
|
287
|
-
|
|
287
|
+
history.redo();
|
|
288
288
|
}
|
|
289
289
|
});
|
|
290
290
|
}
|
|
@@ -115,7 +115,7 @@ export class TextAreaEditor
|
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
replaceUndoManager(): void {
|
|
118
|
-
const {
|
|
118
|
+
const { history } = this.jodit;
|
|
119
119
|
|
|
120
120
|
this.j.e.on(
|
|
121
121
|
this.instance,
|
|
@@ -123,9 +123,9 @@ export class TextAreaEditor
|
|
|
123
123
|
(e: KeyboardEvent): false | void => {
|
|
124
124
|
if ((e.ctrlKey || e.metaKey) && e.key === 'z') {
|
|
125
125
|
if (e.shiftKey) {
|
|
126
|
-
|
|
126
|
+
history.redo();
|
|
127
127
|
} else {
|
|
128
|
-
|
|
128
|
+
history.undo();
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
this.setSelectionRange(this.getValue().length);
|
|
@@ -86,7 +86,7 @@ export class source extends Plugin {
|
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
this.__lock = true;
|
|
89
|
-
this.j.
|
|
89
|
+
this.j.value = value;
|
|
90
90
|
this.__lock = false;
|
|
91
91
|
this.__oldMirrorValue = value;
|
|
92
92
|
}
|
|
@@ -156,11 +156,11 @@ export class source extends Plugin {
|
|
|
156
156
|
return this.sourceEditor?.getValue() || '';
|
|
157
157
|
}
|
|
158
158
|
|
|
159
|
-
private setMirrorValue(value: string) {
|
|
159
|
+
private setMirrorValue(value: string): void {
|
|
160
160
|
this.sourceEditor?.setValue(value);
|
|
161
161
|
}
|
|
162
162
|
|
|
163
|
-
private setFocusToMirror() {
|
|
163
|
+
private setFocusToMirror(): void {
|
|
164
164
|
this.sourceEditor?.focus();
|
|
165
165
|
}
|
|
166
166
|
|
|
@@ -168,7 +168,7 @@ export class source extends Plugin {
|
|
|
168
168
|
protected saveSelection(): void {
|
|
169
169
|
if (this.j.getRealMode() === consts.MODE_WYSIWYG) {
|
|
170
170
|
this.j.s.save();
|
|
171
|
-
this.j.
|
|
171
|
+
this.j.synchronizeValues();
|
|
172
172
|
this.fromWYSIWYG(true);
|
|
173
173
|
} else {
|
|
174
174
|
if (this.j.o.editHTMLDocumentMode) {
|
|
@@ -317,7 +317,7 @@ export class source extends Plugin {
|
|
|
317
317
|
.on('beautifyHTML', html => html);
|
|
318
318
|
|
|
319
319
|
if (editor.o.beautifyHTML) {
|
|
320
|
-
const addEventListener = () => {
|
|
320
|
+
const addEventListener = (): boolean => {
|
|
321
321
|
const html_beautify = (editor.ow as any).html_beautify;
|
|
322
322
|
|
|
323
323
|
if (html_beautify && !editor.isInDestruct) {
|
|
@@ -343,7 +343,7 @@ export class source extends Plugin {
|
|
|
343
343
|
}
|
|
344
344
|
|
|
345
345
|
@autobind
|
|
346
|
-
private syncValueFromWYSIWYG(force: boolean = false) {
|
|
346
|
+
private syncValueFromWYSIWYG(force: boolean = false): void {
|
|
347
347
|
const editor = this.j;
|
|
348
348
|
|
|
349
349
|
if (
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
The plugin turns on/off spell checking. Also adds a button to the toolbar for this.
|