jodit 4.2.38 → 4.2.40
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/CHANGELOG.md +42 -5
- package/es2015/jodit.css +7 -1
- package/es2015/jodit.fat.min.css +1 -1
- package/es2015/jodit.fat.min.js +2 -2
- package/es2015/jodit.js +74 -37
- package/es2015/jodit.min.css +1 -1
- package/es2015/jodit.min.js +2 -2
- package/es2015/plugins/debug/debug.css +53 -0
- package/es2015/plugins/debug/debug.js +162 -24
- package/es2015/plugins/debug/debug.min.css +1 -0
- package/es2015/plugins/debug/debug.min.js +2 -2
- package/es2015/plugins/speech-recognize/speech-recognize.css +1 -1
- package/es2015/plugins/speech-recognize/speech-recognize.js +1 -1
- package/es2015/plugins/speech-recognize/speech-recognize.min.js +1 -1
- package/es2018/jodit.css +7 -1
- package/es2018/jodit.fat.min.css +1 -1
- package/es2018/jodit.fat.min.js +2 -2
- package/es2018/jodit.js +74 -37
- package/es2018/jodit.min.css +1 -1
- package/es2018/jodit.min.js +2 -2
- package/es2018/plugins/debug/debug.css +53 -0
- package/es2018/plugins/debug/debug.js +162 -24
- package/es2018/plugins/debug/debug.min.css +1 -0
- package/es2018/plugins/debug/debug.min.js +2 -2
- package/es2018/plugins/speech-recognize/speech-recognize.css +1 -1
- package/es2018/plugins/speech-recognize/speech-recognize.js +1 -1
- package/es2018/plugins/speech-recognize/speech-recognize.min.js +1 -1
- package/es2021/jodit.css +7 -1
- package/es2021/jodit.fat.min.css +1 -1
- package/es2021/jodit.fat.min.js +2 -2
- package/es2021/jodit.js +74 -36
- package/es2021/jodit.min.css +1 -1
- package/es2021/jodit.min.js +2 -2
- package/es2021/plugins/debug/debug.css +53 -0
- package/es2021/plugins/debug/debug.js +161 -24
- package/es2021/plugins/debug/debug.min.css +1 -0
- package/es2021/plugins/debug/debug.min.js +2 -2
- package/es2021/plugins/speech-recognize/speech-recognize.css +1 -1
- package/es2021/plugins/speech-recognize/speech-recognize.js +1 -1
- package/es2021/plugins/speech-recognize/speech-recognize.min.js +1 -1
- package/es2021.en/jodit.css +7 -1
- package/es2021.en/jodit.fat.min.css +1 -1
- package/es2021.en/jodit.fat.min.js +2 -2
- package/es2021.en/jodit.js +74 -36
- package/es2021.en/jodit.min.css +1 -1
- package/es2021.en/jodit.min.js +2 -2
- package/es2021.en/plugins/debug/debug.css +53 -0
- package/es2021.en/plugins/debug/debug.js +161 -24
- package/es2021.en/plugins/debug/debug.min.css +1 -0
- package/es2021.en/plugins/debug/debug.min.js +2 -2
- package/es2021.en/plugins/speech-recognize/speech-recognize.css +1 -1
- package/es2021.en/plugins/speech-recognize/speech-recognize.js +1 -1
- package/es2021.en/plugins/speech-recognize/speech-recognize.min.js +1 -1
- package/es5/164.fat.min.js +2 -2
- package/es5/164.js +6 -6
- package/es5/164.min.js +2 -2
- package/es5/5.fat.min.js +1 -1
- package/es5/5.min.js +1 -1
- package/es5/jodit.css +11 -2
- package/es5/jodit.fat.min.css +1 -1
- package/es5/jodit.fat.min.js +2 -2
- package/es5/jodit.js +80 -46
- package/es5/jodit.min.css +3 -3
- package/es5/jodit.min.js +2 -2
- package/es5/plugins/debug/debug.css +53 -0
- package/es5/plugins/debug/debug.js +161 -24
- package/es5/plugins/debug/debug.min.css +1 -0
- package/es5/plugins/debug/debug.min.js +2 -2
- package/es5/plugins/speech-recognize/speech-recognize.css +1 -1
- package/es5/plugins/speech-recognize/speech-recognize.js +1 -1
- package/es5/plugins/speech-recognize/speech-recognize.min.js +1 -1
- package/esm/core/constants.js +1 -1
- package/esm/core/ui/button/tooltip/tooltip.d.ts +1 -0
- package/esm/core/ui/button/tooltip/tooltip.js +19 -8
- package/esm/core/view/view-with-toolbar.d.ts +1 -0
- package/esm/core/view/view-with-toolbar.js +3 -0
- package/esm/modules/toolbar/collection/collection.d.ts +0 -1
- package/esm/modules/toolbar/collection/collection.js +1 -4
- package/esm/plugins/debug/debug.d.ts +1 -0
- package/esm/plugins/enter/helpers/check-br.js +2 -0
- package/esm/plugins/index.js +1 -0
- package/esm/plugins/inline-popup/inline-popup.d.ts +0 -1
- package/esm/plugins/inline-popup/inline-popup.js +7 -7
- package/package.json +1 -1
- package/types/core/ui/button/tooltip/tooltip.d.ts +1 -0
- package/types/core/view/view-with-toolbar.d.ts +1 -0
- package/types/modules/toolbar/collection/collection.d.ts +0 -1
- package/types/plugins/debug/debug.d.ts +1 -0
- package/types/plugins/inline-popup/inline-popup.d.ts +0 -1
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* jodit - Jodit is an awesome and useful wysiwyg editor with filebrowser
|
|
3
|
+
* Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/jodit/)
|
|
4
|
+
* Version: v4.2.40
|
|
5
|
+
* Url: https://xdsoft.net/jodit/
|
|
6
|
+
* License(s): MIT
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
.jodit-debug {
|
|
10
|
+
background: #f6f6f6;
|
|
11
|
+
position: relative;
|
|
12
|
+
padding: 0;
|
|
13
|
+
display: flex;
|
|
14
|
+
justify-content: space-between;
|
|
15
|
+
align-items: stretch;
|
|
16
|
+
}
|
|
17
|
+
.jodit-debug > * {
|
|
18
|
+
padding: var(--jd-padding-default);
|
|
19
|
+
}
|
|
20
|
+
.jodit-debug__tree {
|
|
21
|
+
width: 40%;
|
|
22
|
+
}
|
|
23
|
+
.jodit-debug__tree .jodit-debug__tree-elm-name {
|
|
24
|
+
color: #052e88;
|
|
25
|
+
}
|
|
26
|
+
.jodit-debug__tree .jodit-debug__tree-element_selected {
|
|
27
|
+
background: #1e7e34;
|
|
28
|
+
color: #fff;
|
|
29
|
+
}
|
|
30
|
+
.jodit-debug__tree .jodit-debug__tree-cursor {
|
|
31
|
+
background: #dc3232;
|
|
32
|
+
color: #fff;
|
|
33
|
+
}
|
|
34
|
+
.jodit-debug__events {
|
|
35
|
+
width: 40%;
|
|
36
|
+
max-height: 500px;
|
|
37
|
+
overflow: auto;
|
|
38
|
+
background: #1e7e34;
|
|
39
|
+
color: #fff;
|
|
40
|
+
}
|
|
41
|
+
.jodit-debug__events span {
|
|
42
|
+
color: #cacaca;
|
|
43
|
+
font-size: 0.8em;
|
|
44
|
+
}
|
|
45
|
+
.jodit-debug__events .jodit-debug__events-clear {
|
|
46
|
+
position: absolute;
|
|
47
|
+
top: 0;
|
|
48
|
+
right: 0;
|
|
49
|
+
padding: 5px;
|
|
50
|
+
cursor: pointer;
|
|
51
|
+
color: red;
|
|
52
|
+
}
|
|
53
|
+
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* jodit - Jodit is an awesome and useful wysiwyg editor with filebrowser
|
|
3
3
|
* Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/jodit/)
|
|
4
|
-
* Version: v4.2.
|
|
4
|
+
* Version: v4.2.40
|
|
5
5
|
* Url: https://xdsoft.net/jodit/
|
|
6
6
|
* License(s): MIT
|
|
7
7
|
*/
|
|
@@ -44,49 +44,186 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
44
44
|
|
|
45
45
|
|
|
46
46
|
|
|
47
|
+
|
|
47
48
|
var Debug = /** @class */ (function (_super) {
|
|
48
49
|
(0,tslib__WEBPACK_IMPORTED_MODULE_5__/* .__extends */ .C6)(Debug, _super);
|
|
49
50
|
function Debug() {
|
|
50
51
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
51
52
|
}
|
|
52
53
|
Debug.prototype.afterInit = function (jodit) {
|
|
53
|
-
var mirror = jodit.create.div();
|
|
54
|
-
var tree = jodit.create.div();
|
|
55
|
-
var
|
|
54
|
+
var mirror = jodit.create.div('jodit-debug');
|
|
55
|
+
var tree = jodit.create.div('jodit-debug__tree');
|
|
56
|
+
var events = jodit.create.div('jodit-debug__events');
|
|
57
|
+
var clear = jodit.create.div('jodit-debug__events-clear', ['x']);
|
|
58
|
+
var sel = jodit.create.div('jodit-debug__sel');
|
|
56
59
|
mirror.appendChild(tree);
|
|
60
|
+
mirror.appendChild(events);
|
|
61
|
+
events.appendChild(clear);
|
|
57
62
|
mirror.appendChild(sel);
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
backgroundColor: '#fcfcfc'
|
|
62
|
-
});
|
|
63
|
-
Object.assign(sel.style, {
|
|
64
|
-
paddingTop: '16px'
|
|
63
|
+
clear.addEventListener('click', function () {
|
|
64
|
+
events.innerHTML = '';
|
|
65
|
+
events.appendChild(clear);
|
|
65
66
|
});
|
|
66
|
-
jodit.
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
67
|
+
jodit.workplace.appendChild(mirror);
|
|
68
|
+
var allEvents = [
|
|
69
|
+
'activate',
|
|
70
|
+
'afterInit',
|
|
71
|
+
'beforeactivate',
|
|
72
|
+
'beforeblur',
|
|
73
|
+
'beforedeactivate',
|
|
74
|
+
'beforefocus',
|
|
75
|
+
'beforeinput',
|
|
76
|
+
'blur',
|
|
77
|
+
'change',
|
|
78
|
+
'click',
|
|
79
|
+
'compositionend',
|
|
80
|
+
'compositionstart',
|
|
81
|
+
'compositionupdate',
|
|
82
|
+
'contextmenu',
|
|
83
|
+
'copy',
|
|
84
|
+
'cut',
|
|
85
|
+
'dblclick',
|
|
86
|
+
'deactivate',
|
|
87
|
+
'focus',
|
|
88
|
+
'focusin',
|
|
89
|
+
'focusout',
|
|
90
|
+
'focusout',
|
|
91
|
+
'input',
|
|
92
|
+
'keydown',
|
|
93
|
+
'keypress',
|
|
94
|
+
'keyup',
|
|
95
|
+
'mousedown',
|
|
96
|
+
'mouseup',
|
|
97
|
+
'paste',
|
|
98
|
+
'selectionchange',
|
|
99
|
+
'selectionstart',
|
|
100
|
+
'dragstart',
|
|
101
|
+
'drop',
|
|
102
|
+
'dragover',
|
|
103
|
+
'resize touchstart touchend',
|
|
104
|
+
'updateDebug',
|
|
105
|
+
'beforeCommand',
|
|
106
|
+
'afterCommand',
|
|
107
|
+
'wheel'
|
|
108
|
+
];
|
|
109
|
+
function updateTree() {
|
|
71
110
|
var range = jodit.selection.range;
|
|
72
|
-
tree.innerHTML = render(jodit.editor);
|
|
111
|
+
tree.innerHTML = render(jodit.editor, 0, range);
|
|
73
112
|
sel.innerHTML = "start ".concat(range.startContainer.nodeName, " ").concat(range.startOffset, "<br>end ").concat(range.endContainer.nodeName, " ").concat(range.endOffset);
|
|
74
|
-
}
|
|
113
|
+
}
|
|
114
|
+
function onSomeEvent(e) {
|
|
115
|
+
var event = jodit.e.current;
|
|
116
|
+
var div = jodit.create.div();
|
|
117
|
+
div.innerHTML = "<span>".concat(new Date().toLocaleTimeString(), "</span> ").concat(renderEvent(event, e));
|
|
118
|
+
events.appendChild(div);
|
|
119
|
+
events.scrollTop = events.scrollHeight;
|
|
120
|
+
jodit.async.setTimeout(function () {
|
|
121
|
+
events.children.length > 100 &&
|
|
122
|
+
events.removeChild(events.children[0]);
|
|
123
|
+
}, 100);
|
|
124
|
+
}
|
|
125
|
+
function renderEvent(event, e) {
|
|
126
|
+
var result = [event !== null && event !== void 0 ? event : e.type];
|
|
127
|
+
switch (event) {
|
|
128
|
+
case 'beforeCommand':
|
|
129
|
+
case 'afterCommand':
|
|
130
|
+
result.push("<span>".concat(e.toString(), "</span>"));
|
|
131
|
+
break;
|
|
132
|
+
case 'keydown':
|
|
133
|
+
case 'keyup':
|
|
134
|
+
case 'keypress':
|
|
135
|
+
if (e.shiftKey &&
|
|
136
|
+
e.key !== 'Shift') {
|
|
137
|
+
result.push('Shift+');
|
|
138
|
+
}
|
|
139
|
+
if (e.ctrlKey &&
|
|
140
|
+
e.key !== 'Control') {
|
|
141
|
+
result.push('Ctrl+');
|
|
142
|
+
}
|
|
143
|
+
if (e.altKey &&
|
|
144
|
+
e.key !== 'Alt') {
|
|
145
|
+
result.push('Alt');
|
|
146
|
+
}
|
|
147
|
+
result.push("".concat(e.key));
|
|
148
|
+
break;
|
|
149
|
+
}
|
|
150
|
+
if (e && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.isNode(e.target)) {
|
|
151
|
+
result.push("<span>".concat(e.target.nodeName, "</span>"));
|
|
152
|
+
}
|
|
153
|
+
return result.join(' ');
|
|
154
|
+
}
|
|
155
|
+
jodit.e
|
|
156
|
+
.on('keydown keyup keypress change afterInit updateDebug', updateTree)
|
|
157
|
+
.on(allEvents, onSomeEvent)
|
|
158
|
+
.on(jodit.od, 'selectionchange', onSomeEvent)
|
|
159
|
+
.on(jodit.od, 'selectionchange', updateTree);
|
|
75
160
|
};
|
|
76
161
|
Debug.prototype.beforeDestruct = function (jodit) { };
|
|
77
162
|
return Debug;
|
|
78
163
|
}(jodit_core_plugin_plugin__WEBPACK_IMPORTED_MODULE_4__/* .Plugin */ .k));
|
|
79
164
|
|
|
80
|
-
function renderText(elm) {
|
|
165
|
+
function renderText(elm, range) {
|
|
81
166
|
if (!elm.nodeValue) {
|
|
82
167
|
return "<span style='color:red'>empty</span>";
|
|
83
168
|
}
|
|
84
|
-
|
|
169
|
+
var value = elm.nodeValue;
|
|
170
|
+
if (range.collapsed) {
|
|
171
|
+
if (elm === range.startContainer) {
|
|
172
|
+
value =
|
|
173
|
+
value.slice(0, range.startOffset) +
|
|
174
|
+
'%CURSOR%' +
|
|
175
|
+
value.slice(range.startOffset);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
else {
|
|
179
|
+
if (elm === range.startContainer && elm === range.endContainer) {
|
|
180
|
+
value =
|
|
181
|
+
value.slice(0, range.startOffset) +
|
|
182
|
+
'%START-CURSOR%' +
|
|
183
|
+
value.slice(range.startOffset, range.endOffset) +
|
|
184
|
+
'%END-CURSOR%' +
|
|
185
|
+
value.slice(range.endOffset);
|
|
186
|
+
}
|
|
187
|
+
else if (elm === range.startContainer) {
|
|
188
|
+
value =
|
|
189
|
+
value.slice(0, range.startOffset) +
|
|
190
|
+
'%CURSOR%' +
|
|
191
|
+
value.slice(range.startOffset);
|
|
192
|
+
}
|
|
193
|
+
else if (elm === range.endContainer) {
|
|
194
|
+
value =
|
|
195
|
+
value.slice(0, range.endOffset) +
|
|
196
|
+
'%CURSOR%' +
|
|
197
|
+
value.slice(range.endOffset);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
return (0,jodit_core_helpers_html_strip_tags__WEBPACK_IMPORTED_MODULE_3__/* .stripTags */ .K)(value.replace((0,jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.INVISIBLE_SPACE_REG_EXP)(), 'INV'))
|
|
201
|
+
.replace(/%CURSOR%/, '<span class="jodit-debug__tree-cursor">|</span>')
|
|
202
|
+
.replace(/%START-CURSOR%/, '<span class="jodit-debug__tree-cursor">|')
|
|
203
|
+
.replace(/%END-CURSOR%/, '|</span>');
|
|
85
204
|
}
|
|
86
|
-
function render(elm, level) {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
205
|
+
function render(elm, level, range) {
|
|
206
|
+
var _a;
|
|
207
|
+
var isSelected = (_a = window.getSelection()) === null || _a === void 0 ? void 0 : _a.containsNode(elm);
|
|
208
|
+
var content = [
|
|
209
|
+
"<span class=\"jodit-debug__tree-elm-name\">".concat(elm.nodeName, "</span>"),
|
|
210
|
+
jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__/* .Dom */ .J.isText(elm) ? "- ".concat(renderText(elm, range)) : ''
|
|
211
|
+
]
|
|
212
|
+
.map(function (i) { return i.trim(); })
|
|
213
|
+
.filter(Boolean);
|
|
214
|
+
return "<div class=\"".concat(isSelected ? 'jodit-debug__tree-element_selected' : '', "\" style='padding-left: ").concat(level * 5, "px'>\n\t\t").concat(content.join(' '), "\n\t").concat(Array.from(elm.childNodes)
|
|
215
|
+
.map(function (ch, index) {
|
|
216
|
+
var result = [];
|
|
217
|
+
if (range.startContainer === elm && index === range.startOffset) {
|
|
218
|
+
result.push('<span class="jodit-debug__tree-cursor">|</span>');
|
|
219
|
+
}
|
|
220
|
+
result.push(render(ch, level + 1, range));
|
|
221
|
+
if (range.endContainer === elm && index === range.endOffset) {
|
|
222
|
+
result.push('<span class="jodit-debug__tree-cursor">|</span>');
|
|
223
|
+
}
|
|
224
|
+
return result;
|
|
225
|
+
})
|
|
226
|
+
.flat()
|
|
90
227
|
.join(''), "\n</div>");
|
|
91
228
|
}
|
|
92
229
|
// pluginSystem.add('debug', Debug);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.jodit-debug{align-items:stretch;background:#f6f6f6;display:flex;justify-content:space-between;padding:0;position:relative}.jodit-debug>*{padding:var(--jd-padding-default)}.jodit-debug__tree{width:40%}.jodit-debug__tree .jodit-debug__tree-elm-name{color:#052e88}.jodit-debug__tree .jodit-debug__tree-element_selected{background:#1e7e34;color:#fff}.jodit-debug__tree .jodit-debug__tree-cursor{background:#dc3232;color:#fff}.jodit-debug__events{background:#1e7e34;color:#fff;max-height:500px;overflow:auto;width:40%}.jodit-debug__events span{color:#cacaca;font-size:.8em}.jodit-debug__events .jodit-debug__events-clear{color:red;cursor:pointer;padding:5px;position:absolute;right:0;top:0}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* jodit - Jodit is an awesome and useful wysiwyg editor with filebrowser
|
|
3
3
|
* Author: Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/jodit/)
|
|
4
|
-
* Version: v4.2.
|
|
4
|
+
* Version: v4.2.40
|
|
5
5
|
* Url: https://xdsoft.net/jodit/
|
|
6
6
|
* License(s): MIT
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
"use strict";!function(e,
|
|
10
|
+
"use strict";!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n=t();for(var o in n)("object"==typeof exports?exports:e)[o]=n[o]}}(self,(function(){return(self.webpackChunkjodit=self.webpackChunkjodit||[]).push([[486],{40773:function(e,t,n){n.r(t),n.d(t,{Debug:function(){return c}});var o=n(31635),a=n(17352),r=n(55186),s=(n(56298),n(61793)),c=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,o.C6)(t,e),t.prototype.afterInit=function(e){var t=e.create.div("jodit-debug"),n=e.create.div("jodit-debug__tree"),o=e.create.div("jodit-debug__events"),a=e.create.div("jodit-debug__events-clear",["x"]),s=e.create.div("jodit-debug__sel");function c(){var t=e.selection.range;n.innerHTML=d(e.editor,0,t),s.innerHTML="start ".concat(t.startContainer.nodeName," ").concat(t.startOffset,"<br>end ").concat(t.endContainer.nodeName," ").concat(t.endOffset)}function i(t){var n=e.e.current,a=e.create.div();a.innerHTML="<span>".concat((new Date).toLocaleTimeString(),"</span> ").concat(function(e,t){var n=[null!=e?e:t.type];switch(e){case"beforeCommand":case"afterCommand":n.push("<span>".concat(t.toString(),"</span>"));break;case"keydown":case"keyup":case"keypress":t.shiftKey&&"Shift"!==t.key&&n.push("Shift+"),t.ctrlKey&&"Control"!==t.key&&n.push("Ctrl+"),t.altKey&&"Alt"!==t.key&&n.push("Alt"),n.push("".concat(t.key))}return t&&r.J.isNode(t.target)&&n.push("<span>".concat(t.target.nodeName,"</span>")),n.join(" ")}(n,t)),o.appendChild(a),o.scrollTop=o.scrollHeight,e.async.setTimeout((function(){o.children.length>100&&o.removeChild(o.children[0])}),100)}t.appendChild(n),t.appendChild(o),o.appendChild(a),t.appendChild(s),a.addEventListener("click",(function(){o.innerHTML="",o.appendChild(a)})),e.workplace.appendChild(t),e.e.on("keydown keyup keypress change afterInit updateDebug",c).on(["activate","afterInit","beforeactivate","beforeblur","beforedeactivate","beforefocus","beforeinput","blur","change","click","compositionend","compositionstart","compositionupdate","contextmenu","copy","cut","dblclick","deactivate","focus","focusin","focusout","focusout","input","keydown","keypress","keyup","mousedown","mouseup","paste","selectionchange","selectionstart","dragstart","drop","dragover","resize touchstart touchend","updateDebug","beforeCommand","afterCommand","wheel"],i).on(e.od,"selectionchange",i).on(e.od,"selectionchange",c)},t.prototype.beforeDestruct=function(e){},t}(n(29866).k);function i(e,t){if(!e.nodeValue)return"<span style='color:red'>empty</span>";var n=e.nodeValue;return t.collapsed?e===t.startContainer&&(n=n.slice(0,t.startOffset)+"%CURSOR%"+n.slice(t.startOffset)):e===t.startContainer&&e===t.endContainer?n=n.slice(0,t.startOffset)+"%START-CURSOR%"+n.slice(t.startOffset,t.endOffset)+"%END-CURSOR%"+n.slice(t.endOffset):e===t.startContainer?n=n.slice(0,t.startOffset)+"%CURSOR%"+n.slice(t.startOffset):e===t.endContainer&&(n=n.slice(0,t.endOffset)+"%CURSOR%"+n.slice(t.endOffset)),(0,s.K)(n.replace((0,a.INVISIBLE_SPACE_REG_EXP)(),"INV")).replace(/%CURSOR%/,'<span class="jodit-debug__tree-cursor">|</span>').replace(/%START-CURSOR%/,'<span class="jodit-debug__tree-cursor">|').replace(/%END-CURSOR%/,"|</span>")}function d(e,t,n){var o,a=null===(o=window.getSelection())||void 0===o?void 0:o.containsNode(e),s=['<span class="jodit-debug__tree-elm-name">'.concat(e.nodeName,"</span>"),r.J.isText(e)?"- ".concat(i(e,n)):""].map((function(e){return e.trim()})).filter(Boolean);return'<div class="'.concat(a?"jodit-debug__tree-element_selected":"","\" style='padding-left: ").concat(5*t,"px'>\n\t\t").concat(s.join(" "),"\n\t").concat(Array.from(e.childNodes).map((function(o,a){var r=[];return n.startContainer===e&&a===n.startOffset&&r.push('<span class="jodit-debug__tree-cursor">|</span>'),r.push(d(o,t+1,n)),n.endContainer===e&&a===n.endOffset&&r.push('<span class="jodit-debug__tree-cursor">|</span>'),r})).flat().join(""),"\n</div>")}}},function(e){return e(e.s=40773)}])}));
|
package/esm/core/constants.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
4
4
|
* Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
|
|
5
5
|
*/
|
|
6
|
-
export const APP_VERSION = "4.2.
|
|
6
|
+
export const APP_VERSION = "4.2.40";
|
|
7
7
|
// prettier-ignore
|
|
8
8
|
export const ES = "es2020";
|
|
9
9
|
export const IS_ES_MODERN = true;
|
|
@@ -32,6 +32,7 @@ const JODIT_EVENTS_ON_HIDE = [
|
|
|
32
32
|
'changePlace.tooltip',
|
|
33
33
|
'afterOpenPopup.tooltip',
|
|
34
34
|
'hidePopup.tooltip',
|
|
35
|
+
'beforePopupClose.tooltip',
|
|
35
36
|
'closeAllPopups.tooltip'
|
|
36
37
|
];
|
|
37
38
|
let UITooltip = UITooltip_1 = class UITooltip extends UIElement {
|
|
@@ -44,6 +45,7 @@ let UITooltip = UITooltip_1 = class UITooltip extends UIElement {
|
|
|
44
45
|
constructor(view) {
|
|
45
46
|
super(view);
|
|
46
47
|
this.__isOpened = false;
|
|
48
|
+
this.__attachedContainers = new Set();
|
|
47
49
|
this.__listenClose = false;
|
|
48
50
|
this.__currentTarget = null;
|
|
49
51
|
this.__delayShowTimeout = 0;
|
|
@@ -62,7 +64,16 @@ let UITooltip = UITooltip_1 = class UITooltip extends UIElement {
|
|
|
62
64
|
__onAttach(container) {
|
|
63
65
|
// TODO Move it inside __show method. Now it is here because testcase failed with capturing
|
|
64
66
|
getContainer(this.j, UITooltip_1).appendChild(this.container);
|
|
65
|
-
this.
|
|
67
|
+
this.__attachedContainers.add(container);
|
|
68
|
+
this.__attachedContainers.add(this.j.container);
|
|
69
|
+
this.j.e
|
|
70
|
+
.on(container, 'mouseenter.tooltip', this.__onMouseEnter, {
|
|
71
|
+
capture: true
|
|
72
|
+
})
|
|
73
|
+
.on(container, 'mouseleave.tooltip', this.__onMouseLeave, {
|
|
74
|
+
capture: true
|
|
75
|
+
})
|
|
76
|
+
.on(this.j.container, 'mouseleave.tooltip', this.__onMouseLeave, {
|
|
66
77
|
capture: true
|
|
67
78
|
});
|
|
68
79
|
}
|
|
@@ -74,10 +85,7 @@ let UITooltip = UITooltip_1 = class UITooltip extends UIElement {
|
|
|
74
85
|
const view = this.j;
|
|
75
86
|
view.e
|
|
76
87
|
.on(view.ow, WINDOW_EVENTS_ON_HIDE, this.__hide)
|
|
77
|
-
.on(JODIT_EVENTS_ON_HIDE, this.__hide)
|
|
78
|
-
.on(view.container, 'mouseleave.tooltip', this.__onMouseLeave, {
|
|
79
|
-
capture: true
|
|
80
|
-
});
|
|
88
|
+
.on(JODIT_EVENTS_ON_HIDE, this.__hide);
|
|
81
89
|
}
|
|
82
90
|
__removeListenersOnLeave() {
|
|
83
91
|
if (!this.__listenClose) {
|
|
@@ -87,8 +95,7 @@ let UITooltip = UITooltip_1 = class UITooltip extends UIElement {
|
|
|
87
95
|
const view = this.j;
|
|
88
96
|
view.e
|
|
89
97
|
.off(view.ow, WINDOW_EVENTS_ON_HIDE, this.__hide)
|
|
90
|
-
.off(JODIT_EVENTS_ON_HIDE, this.__hide)
|
|
91
|
-
.off(view.container, 'mouseleave.tooltip', this.__onMouseLeave);
|
|
98
|
+
.off(JODIT_EVENTS_ON_HIDE, this.__hide);
|
|
92
99
|
}
|
|
93
100
|
__onMouseLeave(e) {
|
|
94
101
|
if (this.__currentTarget === e.target) {
|
|
@@ -165,7 +172,11 @@ let UITooltip = UITooltip_1 = class UITooltip extends UIElement {
|
|
|
165
172
|
this.__hideTimeout = this.async.setTimeout(this.__hide, this.j.defaultTimeout);
|
|
166
173
|
}
|
|
167
174
|
destruct() {
|
|
168
|
-
this.
|
|
175
|
+
this.__attachedContainers.forEach(container => {
|
|
176
|
+
this.j.e
|
|
177
|
+
.off(container, 'mouseenter.tooltip', this.__onMouseEnter)
|
|
178
|
+
.off(container, 'mouseleave.tooltip', this.__onMouseLeave);
|
|
179
|
+
});
|
|
169
180
|
this.__hide();
|
|
170
181
|
super.destruct();
|
|
171
182
|
}
|
|
@@ -41,6 +41,7 @@ export declare abstract class ViewWithToolbar extends View implements IViewWithT
|
|
|
41
41
|
*/
|
|
42
42
|
private beforeToolbarBuild;
|
|
43
43
|
readonly isJodit: boolean;
|
|
44
|
+
private __tooltip;
|
|
44
45
|
/** @override **/
|
|
45
46
|
protected constructor(options?: Partial<IViewOptions>, isJodit?: boolean);
|
|
46
47
|
destruct(): void;
|
|
@@ -20,6 +20,7 @@ import { Dom } from "../dom/dom.js";
|
|
|
20
20
|
import { splitArray } from "../helpers/array/index.js";
|
|
21
21
|
import { isString } from "../helpers/checker/is-string.js";
|
|
22
22
|
import { resolveElement } from "../helpers/utils/selector.js";
|
|
23
|
+
import { UITooltip } from "../ui/index.js";
|
|
23
24
|
import { isButtonGroup } from "../ui/helpers/buttons.js";
|
|
24
25
|
import { View } from "./view.js";
|
|
25
26
|
import { makeCollection } from "../../modules/toolbar/factory.js";
|
|
@@ -124,6 +125,7 @@ export class ViewWithToolbar extends View {
|
|
|
124
125
|
this.registeredButtons = new Set();
|
|
125
126
|
this.groupToButtons = {};
|
|
126
127
|
this.isJodit = false;
|
|
128
|
+
this.__tooltip = new UITooltip(this);
|
|
127
129
|
this.isJodit = isJodit;
|
|
128
130
|
this.e.on('beforeToolbarBuild', this.beforeToolbarBuild);
|
|
129
131
|
}
|
|
@@ -133,6 +135,7 @@ export class ViewWithToolbar extends View {
|
|
|
133
135
|
}
|
|
134
136
|
this.setStatus(STATUSES.beforeDestruct);
|
|
135
137
|
this.e.off('beforeToolbarBuild', this.beforeToolbarBuild);
|
|
138
|
+
this.__tooltip.destruct();
|
|
136
139
|
this.toolbar.destruct();
|
|
137
140
|
// @ts-ignore After destruct, we are not responsible for anything
|
|
138
141
|
this.toolbar = undefined;
|
|
@@ -39,7 +39,6 @@ export declare class ToolbarCollection<T extends IViewWithToolbar = IViewWithToo
|
|
|
39
39
|
* Set direction
|
|
40
40
|
*/
|
|
41
41
|
setDirection(direction: 'rtl' | 'ltr'): void;
|
|
42
|
-
private __tooltip;
|
|
43
42
|
constructor(jodit: IViewBased);
|
|
44
43
|
protected __initEvents(): void;
|
|
45
44
|
hide(): void;
|
|
@@ -15,7 +15,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
15
15
|
};
|
|
16
16
|
import { autobind, component, debounce, hook } from "../../../core/decorators/index.js";
|
|
17
17
|
import { error } from "../../../core/helpers/utils/error/error.js";
|
|
18
|
-
import { UIList
|
|
18
|
+
import { UIList } from "../../../core/ui/index.js";
|
|
19
19
|
import { makeButton, makeSelect } from "../factory.js";
|
|
20
20
|
let ToolbarCollection = class ToolbarCollection extends UIList {
|
|
21
21
|
/** @override */
|
|
@@ -74,7 +74,6 @@ let ToolbarCollection = class ToolbarCollection extends UIList {
|
|
|
74
74
|
super(jodit);
|
|
75
75
|
this.__listenEvents = 'updatePlugins updateToolbar changeStack mousedown mouseup keydown change afterInit readonly afterResize ' +
|
|
76
76
|
'selectionchange changeSelection focus afterSetMode touchstart focus blur';
|
|
77
|
-
this.__tooltip = new UITooltip(this.jodit);
|
|
78
77
|
}
|
|
79
78
|
__initEvents() {
|
|
80
79
|
this.j.e
|
|
@@ -104,8 +103,6 @@ let ToolbarCollection = class ToolbarCollection extends UIList {
|
|
|
104
103
|
if (this.isDestructed) {
|
|
105
104
|
return;
|
|
106
105
|
}
|
|
107
|
-
this.__tooltip?.destruct();
|
|
108
|
-
this.__tooltip = null;
|
|
109
106
|
this.j.e
|
|
110
107
|
.off(this.__listenEvents, this.update)
|
|
111
108
|
.off('afterSetMode focus', this.__immediateUpdate);
|
|
@@ -12,9 +12,11 @@ import { scrollIntoViewIfNeeded } from "../../../core/helpers/utils/scroll-into-
|
|
|
12
12
|
*/
|
|
13
13
|
export function checkBR(fake, jodit, shiftKeyPressed) {
|
|
14
14
|
const isMultiLineBlock = Boolean(Dom.closest(fake, ['pre', 'blockquote'], jodit.editor));
|
|
15
|
+
const isCell = !isMultiLineBlock && Dom.closest(fake, ['td', 'th'], jodit.editor);
|
|
15
16
|
const isBRMode = jodit.o.enter.toLowerCase() === BR.toLowerCase();
|
|
16
17
|
// if you use <br> defaultTag for break line or when was entered SHIFt key or in <td> or <th> or <blockquote>
|
|
17
18
|
if (isBRMode ||
|
|
19
|
+
isCell ||
|
|
18
20
|
(shiftKeyPressed && !isMultiLineBlock) ||
|
|
19
21
|
(!shiftKeyPressed && isMultiLineBlock)) {
|
|
20
22
|
// 2 BR before
|
package/esm/plugins/index.js
CHANGED
|
@@ -167,10 +167,10 @@ export class inlinePopup extends Plugin {
|
|
|
167
167
|
if (!this.j.o.toolbarInlineForSelection) {
|
|
168
168
|
return;
|
|
169
169
|
}
|
|
170
|
-
const type = 'selection'
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
170
|
+
const type = 'selection';
|
|
171
|
+
const sel = this.j.s.sel;
|
|
172
|
+
const range = this.j.s.range;
|
|
173
|
+
if (sel?.isCollapsed || this.isSelectedTarget(range)) {
|
|
174
174
|
if (this.type === type && this.popup.isOpened) {
|
|
175
175
|
this.hidePopup();
|
|
176
176
|
}
|
|
@@ -195,9 +195,9 @@ export class inlinePopup extends Plugin {
|
|
|
195
195
|
/**
|
|
196
196
|
* Shortcut for Table module
|
|
197
197
|
*/
|
|
198
|
-
get tableModule() {
|
|
199
|
-
|
|
200
|
-
}
|
|
198
|
+
// private get tableModule(): Table {
|
|
199
|
+
// return this.j.getInstance<Table>('Table', this.j.o);
|
|
200
|
+
// }
|
|
201
201
|
/** @override **/
|
|
202
202
|
beforeDestruct(jodit) {
|
|
203
203
|
jodit.e
|
package/package.json
CHANGED
|
@@ -41,6 +41,7 @@ export declare abstract class ViewWithToolbar extends View implements IViewWithT
|
|
|
41
41
|
*/
|
|
42
42
|
private beforeToolbarBuild;
|
|
43
43
|
readonly isJodit: boolean;
|
|
44
|
+
private __tooltip;
|
|
44
45
|
/** @override **/
|
|
45
46
|
protected constructor(options?: Partial<IViewOptions>, isJodit?: boolean);
|
|
46
47
|
destruct(): void;
|
|
@@ -39,7 +39,6 @@ export declare class ToolbarCollection<T extends IViewWithToolbar = IViewWithToo
|
|
|
39
39
|
* Set direction
|
|
40
40
|
*/
|
|
41
41
|
setDirection(direction: 'rtl' | 'ltr'): void;
|
|
42
|
-
private __tooltip;
|
|
43
42
|
constructor(jodit: IViewBased);
|
|
44
43
|
protected __initEvents(): void;
|
|
45
44
|
hide(): void;
|