jodit 4.16.1 → 4.17.1
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 +21 -0
- package/es2015/jodit.css +1 -1
- package/es2015/jodit.fat.min.js +7 -7
- package/es2015/jodit.js +173 -34
- package/es2015/jodit.min.js +7 -7
- package/es2015/plugins/debug/debug.css +1 -1
- package/es2015/plugins/debug/debug.js +1 -1
- package/es2015/plugins/debug/debug.min.js +1 -1
- 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.fat.min.js +7 -7
- package/es2018/jodit.min.js +7 -7
- package/es2018/plugins/debug/debug.min.js +1 -1
- package/es2018/plugins/speech-recognize/speech-recognize.min.js +1 -1
- package/es2021/jodit.css +1 -1
- package/es2021/jodit.fat.min.js +8 -8
- package/es2021/jodit.js +165 -33
- package/es2021/jodit.min.js +8 -8
- package/es2021/plugins/debug/debug.css +1 -1
- package/es2021/plugins/debug/debug.js +1 -1
- package/es2021/plugins/debug/debug.min.js +1 -1
- 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 +1 -1
- package/es2021.en/jodit.fat.min.js +8 -8
- package/es2021.en/jodit.js +165 -33
- package/es2021.en/jodit.min.js +8 -8
- package/es2021.en/plugins/debug/debug.css +1 -1
- package/es2021.en/plugins/debug/debug.js +1 -1
- package/es2021.en/plugins/debug/debug.min.js +1 -1
- 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/jodit.css +2 -2
- package/es5/jodit.fat.min.js +2 -2
- package/es5/jodit.js +182 -34
- package/es5/jodit.min.css +2 -2
- package/es5/jodit.min.js +2 -2
- package/es5/plugins/debug/debug.css +1 -1
- package/es5/plugins/debug/debug.js +1 -1
- package/es5/plugins/debug/debug.min.js +1 -1
- 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/es5/polyfills.fat.min.js +1 -1
- package/es5/polyfills.js +1 -1
- package/es5/polyfills.min.js +1 -1
- package/esm/config.d.ts +40 -1
- package/esm/core/constants.js +1 -1
- package/esm/core/helpers/html/safe-html.d.ts +1 -1
- package/esm/core/helpers/html/safe-html.js +8 -1
- package/esm/modules/widget/file-selector/file-selector.d.ts +10 -1
- package/esm/modules/widget/file-selector/file-selector.js +30 -18
- package/esm/plugins/drag-and-drop/drag-and-drop.js +16 -4
- package/esm/plugins/file/file.d.ts +24 -1
- package/esm/plugins/file/file.js +17 -1
- package/esm/plugins/inline-popup/config/items/img.js +22 -1
- package/esm/plugins/source/editor/engines/ace.js +2 -1
- package/esm/plugins/source/source.d.ts +17 -0
- package/esm/plugins/source/source.js +60 -8
- package/esm/plugins/video/config.d.ts +21 -1
- package/esm/plugins/video/config.js +22 -2
- package/package.json +1 -1
- package/types/config.d.ts +40 -1
- package/types/core/helpers/html/safe-html.d.ts +1 -1
- package/types/modules/widget/file-selector/file-selector.d.ts +10 -1
- package/types/plugins/file/file.d.ts +24 -1
- package/types/plugins/source/source.d.ts +17 -0
- package/types/plugins/video/config.d.ts +21 -1
package/es2021/jodit.js
CHANGED
|
@@ -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.
|
|
4
|
+
* Version: v4.17.1
|
|
5
5
|
* Url: https://xdsoft.net/jodit/
|
|
6
6
|
* License(s): MIT
|
|
7
7
|
*/
|
|
@@ -1799,7 +1799,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1799
1799
|
* ```
|
|
1800
1800
|
* @packageDocumentation
|
|
1801
1801
|
* @module constants
|
|
1802
|
-
*/ const APP_VERSION = "4.
|
|
1802
|
+
*/ const APP_VERSION = "4.17.1";
|
|
1803
1803
|
// prettier-ignore
|
|
1804
1804
|
const ES = "es2021";
|
|
1805
1805
|
const IS_ES_MODERN = true;
|
|
@@ -6281,7 +6281,7 @@ function isSmuggledForeignHtml(elm) {
|
|
|
6281
6281
|
}
|
|
6282
6282
|
return /^data:image\/svg/.test(normalized) && DOCUMENT_EMBED_TAGS.has(tagName);
|
|
6283
6283
|
}
|
|
6284
|
-
function sanitizeHTMLElement(elm, { safeJavaScriptLink, removeOnError } = {
|
|
6284
|
+
function sanitizeHTMLElement(elm, { safeJavaScriptLink, removeOnError, removeEventAttributes } = {
|
|
6285
6285
|
safeJavaScriptLink: true,
|
|
6286
6286
|
removeOnError: true
|
|
6287
6287
|
}) {
|
|
@@ -6289,6 +6289,13 @@ function sanitizeHTMLElement(elm, { safeJavaScriptLink, removeOnError } = {
|
|
|
6289
6289
|
return false;
|
|
6290
6290
|
}
|
|
6291
6291
|
let effected = false;
|
|
6292
|
+
// Every `on*` handler, not only `onerror`: the clean-html background
|
|
6293
|
+
// pass calls this directly, and markup that reached the editable area
|
|
6294
|
+
// without `safeHTML` (a drop, a script) kept its handlers otherwise.
|
|
6295
|
+
// See GHSA-jhhp-r3r7-v2cg
|
|
6296
|
+
if (removeEventAttributes && removeAllEventAttributes(elm)) {
|
|
6297
|
+
effected = true;
|
|
6298
|
+
}
|
|
6292
6299
|
if (removeOnError && elm.hasAttribute('onerror')) {
|
|
6293
6300
|
(0,jodit_core_helpers_utils__WEBPACK_IMPORTED_MODULE_1__.attr)(elm, 'onerror', null);
|
|
6294
6301
|
effected = true;
|
|
@@ -26195,22 +26202,19 @@ jodit_core_ui__WEBPACK_IMPORTED_MODULE_2__.Icon.set('palette', (_palette_svg__WE
|
|
|
26195
26202
|
const tabs = [];
|
|
26196
26203
|
const options = editor.o.uploader;
|
|
26197
26204
|
if (callbacks.upload && options.showTabInFileSelector !== false && (options.url || options.insertImageAsBase64URI || options.customUploadFunction)) {
|
|
26198
|
-
const
|
|
26199
|
-
|
|
26200
|
-
const handler = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.isFunction)(
|
|
26205
|
+
const { upload } = callbacks;
|
|
26206
|
+
tabs.push(UploadTab(editor, (resp)=>{
|
|
26207
|
+
const handler = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.isFunction)(upload) ? upload : options.defaultHandlerSuccess;
|
|
26201
26208
|
if ((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.isFunction)(handler)) {
|
|
26202
26209
|
handler.call(editor, resp);
|
|
26203
26210
|
}
|
|
26204
|
-
|
|
26205
|
-
|
|
26206
|
-
|
|
26207
|
-
|
|
26208
|
-
|
|
26209
|
-
|
|
26210
|
-
|
|
26211
|
-
name: 'Upload',
|
|
26212
|
-
content: dragBox
|
|
26213
|
-
});
|
|
26211
|
+
}, isImage ? {
|
|
26212
|
+
label: 'Drop image',
|
|
26213
|
+
accept: 'image/*'
|
|
26214
|
+
} : {
|
|
26215
|
+
label: 'Drop file',
|
|
26216
|
+
accept: '*'
|
|
26217
|
+
}));
|
|
26214
26218
|
}
|
|
26215
26219
|
if (callbacks.filebrowser) {
|
|
26216
26220
|
if (editor.o.filebrowser.ajax.url || editor.o.filebrowser.items.url) {
|
|
@@ -26278,6 +26282,24 @@ jodit_core_ui__WEBPACK_IMPORTED_MODULE_2__.Icon.set('palette', (_palette_svg__WE
|
|
|
26278
26282
|
box.classList.add('jodit-file-selector');
|
|
26279
26283
|
return box;
|
|
26280
26284
|
};
|
|
26285
|
+
/**
|
|
26286
|
+
* The Upload tab: a box that uploads the files dropped on it or chosen in its
|
|
26287
|
+
* file input, then passes the uploader's answer to `onSuccess` and closes the popup
|
|
26288
|
+
*/ const UploadTab = (editor, onSuccess, { label, accept })=>{
|
|
26289
|
+
const dragBox = editor.c.fromHTML('<div class="jodit-drag-and-drop__file-box">' + `<strong>${editor.i18n(label)}</strong>` + `<span><br>${editor.i18n('or click')}</span>` + `<input type="file" accept="${accept}" tabindex="-1" dir="auto" multiple=""/>` + '</div>');
|
|
26290
|
+
editor.uploader.bind(dragBox, (resp)=>{
|
|
26291
|
+
onSuccess.call(editor, resp);
|
|
26292
|
+
editor.e.fire('closeAllPopups');
|
|
26293
|
+
}, (error)=>{
|
|
26294
|
+
editor.message.error(error.message);
|
|
26295
|
+
editor.e.fire('closeAllPopups');
|
|
26296
|
+
});
|
|
26297
|
+
return {
|
|
26298
|
+
icon: 'upload',
|
|
26299
|
+
name: 'Upload',
|
|
26300
|
+
content: dragBox
|
|
26301
|
+
};
|
|
26302
|
+
};
|
|
26281
26303
|
function val(elm, name, value) {
|
|
26282
26304
|
const child = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.first(elm, (node)=>jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isTag(node, 'input') && (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_1__.attr)(node, 'name') === name);
|
|
26283
26305
|
if (!child) {
|
|
@@ -26290,7 +26312,8 @@ function val(elm, name, value) {
|
|
|
26290
26312
|
}
|
|
26291
26313
|
|
|
26292
26314
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, [
|
|
26293
|
-
/* harmony export */ "FileSelectorWidget", 0, /* binding */ FileSelectorWidget
|
|
26315
|
+
/* harmony export */ "FileSelectorWidget", 0, /* binding */ FileSelectorWidget,
|
|
26316
|
+
/* harmony export */ "UploadTab", 0, /* binding */ UploadTab
|
|
26294
26317
|
/* harmony export */ ]);
|
|
26295
26318
|
|
|
26296
26319
|
|
|
@@ -26303,7 +26326,8 @@ function val(elm, name, value) {
|
|
|
26303
26326
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
26304
26327
|
/* harmony export */ ColorPickerWidget: function() { return /* reexport safe */ _color_picker_color_picker__WEBPACK_IMPORTED_MODULE_0__.ColorPickerWidget; },
|
|
26305
26328
|
/* harmony export */ FileSelectorWidget: function() { return /* reexport safe */ _file_selector_file_selector__WEBPACK_IMPORTED_MODULE_1__.FileSelectorWidget; },
|
|
26306
|
-
/* harmony export */ TabsWidget: function() { return /* reexport safe */ _tabs_tabs__WEBPACK_IMPORTED_MODULE_2__.TabsWidget; }
|
|
26329
|
+
/* harmony export */ TabsWidget: function() { return /* reexport safe */ _tabs_tabs__WEBPACK_IMPORTED_MODULE_2__.TabsWidget; },
|
|
26330
|
+
/* harmony export */ UploadTab: function() { return /* reexport safe */ _file_selector_file_selector__WEBPACK_IMPORTED_MODULE_1__.UploadTab; }
|
|
26307
26331
|
/* harmony export */ });
|
|
26308
26332
|
/* harmony import */ var _color_picker_color_picker__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(72348);
|
|
26309
26333
|
/* harmony import */ var _file_selector_file_selector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(18762);
|
|
@@ -31032,7 +31056,11 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_4__.pluginSystem.add('dragAndDropElem
|
|
|
31032
31056
|
window,
|
|
31033
31057
|
this.j.ed,
|
|
31034
31058
|
this.j.editor
|
|
31035
|
-
], 'dragstart.DragAndDrop', this.onDragStart)
|
|
31059
|
+
], 'dragstart.DragAndDrop', this.onDragStart)// Always, not only after a `dragstart` seen in this window: a drop
|
|
31060
|
+
// from another window or application never produces one here, and
|
|
31061
|
+
// the browser then inserted its HTML natively, unsanitized. Routed
|
|
31062
|
+
// through the paste plugin instead. See GHSA-jhhp-r3r7-v2cg
|
|
31063
|
+
.on('drop.DragAndDrop', this.onDrop);
|
|
31036
31064
|
}
|
|
31037
31065
|
onDragStart(event) {
|
|
31038
31066
|
let target = event.target;
|
|
@@ -31060,10 +31088,10 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_4__.pluginSystem.add('dragAndDropElem
|
|
|
31060
31088
|
this.addDragListeners();
|
|
31061
31089
|
}
|
|
31062
31090
|
addDragListeners() {
|
|
31063
|
-
this.j.e.on('dragover', this.onDrag).on(
|
|
31091
|
+
this.j.e.on('dragover', this.onDrag).on(window, 'dragend.DragAndDrop drop.DragAndDrop mouseup.DragAndDrop', this.onDragEnd);
|
|
31064
31092
|
}
|
|
31065
31093
|
removeDragListeners() {
|
|
31066
|
-
this.j.e.off('dragover', this.onDrag).off(
|
|
31094
|
+
this.j.e.off('dragover', this.onDrag).off(window, 'dragend.DragAndDrop drop.DragAndDrop mouseup.DragAndDrop', this.onDragEnd);
|
|
31067
31095
|
}
|
|
31068
31096
|
onDrag(event) {
|
|
31069
31097
|
if (this.draggable) {
|
|
@@ -31125,7 +31153,12 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_4__.pluginSystem.add('dragAndDropElem
|
|
|
31125
31153
|
fragment = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.dataBind)(this.draggable, 'target');
|
|
31126
31154
|
}
|
|
31127
31155
|
} else if (this.getText(event)) {
|
|
31128
|
-
|
|
31156
|
+
// Dropped markup takes the same sanitizing pass as pasted and
|
|
31157
|
+
// assigned content. See GHSA-jhhp-r3r7-v2cg
|
|
31158
|
+
const box = this.j.createInside.div();
|
|
31159
|
+
box.innerHTML = this.getText(event);
|
|
31160
|
+
this.j.e.fire('safeHTML', box);
|
|
31161
|
+
fragment = box.firstChild !== box.lastChild || !box.firstChild ? box : box.firstChild;
|
|
31129
31162
|
}
|
|
31130
31163
|
return fragment;
|
|
31131
31164
|
}
|
|
@@ -32001,6 +32034,18 @@ function brBefore(start) {
|
|
|
32001
32034
|
|
|
32002
32035
|
|
|
32003
32036
|
|
|
32037
|
+
function insertLinks(data) {
|
|
32038
|
+
data.files?.forEach((file)=>{
|
|
32039
|
+
const link = this.createInside.element('a', {
|
|
32040
|
+
href: data.baseurl + file
|
|
32041
|
+
});
|
|
32042
|
+
link.textContent = this.o.uploader.getDisplayName.call(this.uploader, data.baseurl, file);
|
|
32043
|
+
this.s.insertNode(link);
|
|
32044
|
+
});
|
|
32045
|
+
}
|
|
32046
|
+
jodit_config__WEBPACK_IMPORTED_MODULE_3__.Config.prototype.file = {
|
|
32047
|
+
defaultHandlerSuccess: insertLinks
|
|
32048
|
+
};
|
|
32004
32049
|
jodit_config__WEBPACK_IMPORTED_MODULE_3__.Config.prototype.controls.file = {
|
|
32005
32050
|
popup: (editor, current, close)=>{
|
|
32006
32051
|
const insert = (url, title = '')=>{
|
|
@@ -32015,7 +32060,9 @@ jodit_config__WEBPACK_IMPORTED_MODULE_3__.Config.prototype.controls.file = {
|
|
|
32015
32060
|
data.files && data.files.forEach((file)=>insert(data.baseurl + file));
|
|
32016
32061
|
close();
|
|
32017
32062
|
},
|
|
32018
|
-
upload:
|
|
32063
|
+
upload: (data)=>{
|
|
32064
|
+
(editor.o.file?.defaultHandlerSuccess ?? insertLinks).call(editor, data);
|
|
32065
|
+
},
|
|
32019
32066
|
url: (url, text)=>{
|
|
32020
32067
|
if (sourceAnchor) {
|
|
32021
32068
|
(0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_2__.attr)(sourceAnchor, 'href', url);
|
|
@@ -35518,6 +35565,26 @@ const cmd = (control)=>control.args && (0,jodit_core_helpers_checker__WEBPACK_IM
|
|
|
35518
35565
|
// Images align with `imageAlignClasses`; the wrappers of iframes and media
|
|
35519
35566
|
// keep inline styles
|
|
35520
35567
|
const alignClasses = (editor, elm)=>jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isTag(elm, 'img') ? editor.o.imageAlignClasses : null;
|
|
35568
|
+
// A Normal image sits where the text of its line is aligned (#1531)
|
|
35569
|
+
const lineAlign = (editor, elm)=>{
|
|
35570
|
+
const block = elm && jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.closest(elm, jodit_core_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isBlock, editor.editor) || editor.editor;
|
|
35571
|
+
const rtl = (0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_3__.css)(block, 'direction') === 'rtl';
|
|
35572
|
+
switch((0,jodit_core_helpers_utils_css__WEBPACK_IMPORTED_MODULE_3__.css)(block, 'text-align')){
|
|
35573
|
+
case 'center':
|
|
35574
|
+
case '-webkit-center':
|
|
35575
|
+
return 'center';
|
|
35576
|
+
case 'justify':
|
|
35577
|
+
return 'justify';
|
|
35578
|
+
case 'right':
|
|
35579
|
+
return 'right';
|
|
35580
|
+
case 'end':
|
|
35581
|
+
return rtl ? 'left' : 'right';
|
|
35582
|
+
case 'start':
|
|
35583
|
+
return rtl ? 'right' : 'left';
|
|
35584
|
+
default:
|
|
35585
|
+
return 'left';
|
|
35586
|
+
}
|
|
35587
|
+
};
|
|
35521
35588
|
const currentAlign = (editor, elm)=>elm ? (0,jodit_core_helpers_utils_align__WEBPACK_IMPORTED_MODULE_2__.getHAlign)(elm, alignClasses(editor, elm)) : 'normal';
|
|
35522
35589
|
const align = {
|
|
35523
35590
|
name: 'left',
|
|
@@ -35530,7 +35597,7 @@ const align = {
|
|
|
35530
35597
|
],
|
|
35531
35598
|
update: (editor, button)=>{
|
|
35532
35599
|
const current = currentAlign(editor, button.target);
|
|
35533
|
-
button.state.icon.name = current === 'normal' ?
|
|
35600
|
+
button.state.icon.name = current === 'normal' ? lineAlign(editor, button.target) : current;
|
|
35534
35601
|
},
|
|
35535
35602
|
isActive: (editor, button)=>currentAlign(editor, button.target) !== 'normal',
|
|
35536
35603
|
isChildActive: (editor, button)=>{
|
|
@@ -42098,7 +42165,8 @@ class AceEditor extends jodit_plugins_source_editor_sourceEditor__WEBPACK_IMPORT
|
|
|
42098
42165
|
}
|
|
42099
42166
|
return;
|
|
42100
42167
|
}
|
|
42101
|
-
this
|
|
42168
|
+
// The source plugin carries the fallback editor's text over when this
|
|
42169
|
+
// one is ready; refilling from WYSIWYG here would drop unsynced typing
|
|
42102
42170
|
tryInitAceEditor();
|
|
42103
42171
|
};
|
|
42104
42172
|
editor.e.on('afterSetMode', initAceEditor);
|
|
@@ -42480,6 +42548,7 @@ class SourceEditor {
|
|
|
42480
42548
|
if (new_value !== this.getMirrorValue()) {
|
|
42481
42549
|
this.setMirrorValue(new_value);
|
|
42482
42550
|
}
|
|
42551
|
+
this.__filledValue = this.getMirrorValue();
|
|
42483
42552
|
this.__lock = false;
|
|
42484
42553
|
}
|
|
42485
42554
|
}
|
|
@@ -42648,9 +42717,9 @@ class SourceEditor {
|
|
|
42648
42717
|
return;
|
|
42649
42718
|
}
|
|
42650
42719
|
loading = true;
|
|
42651
|
-
|
|
42652
|
-
|
|
42653
|
-
|
|
42720
|
+
(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.loadNext)(editor, editor.o.beautifyHTMLCDNUrlsJS).then(()=>{
|
|
42721
|
+
addEventListener() && this.beautifyUntouched();
|
|
42722
|
+
}, ()=>null);
|
|
42654
42723
|
};
|
|
42655
42724
|
editor.e.on('afterSetMode.source', loadBeautify);
|
|
42656
42725
|
loadBeautify();
|
|
@@ -42669,9 +42738,7 @@ class SourceEditor {
|
|
|
42669
42738
|
if (editor.o.sourceEditor !== 'area') {
|
|
42670
42739
|
const sourceEditor = (0,_editor_factory__WEBPACK_IMPORTED_MODULE_9__.createSourceEditor)(editor.o.sourceEditor, editor, this.mirrorContainer, this.toWYSIWYG, this.fromWYSIWYG);
|
|
42671
42740
|
sourceEditor.onReadyAlways(()=>{
|
|
42672
|
-
this.sourceEditor
|
|
42673
|
-
this.sourceEditor = sourceEditor;
|
|
42674
|
-
this.syncValueFromWYSIWYG(true);
|
|
42741
|
+
this.takeOver(sourceEditor);
|
|
42675
42742
|
editor.events?.fire('sourceEditorReady', editor);
|
|
42676
42743
|
});
|
|
42677
42744
|
} else {
|
|
@@ -42681,6 +42748,48 @@ class SourceEditor {
|
|
|
42681
42748
|
});
|
|
42682
42749
|
}
|
|
42683
42750
|
}
|
|
42751
|
+
/**
|
|
42752
|
+
* Replaces the source editor (the textarea shown while ACE loads) with
|
|
42753
|
+
* the one that just became ready, carrying its text, selection and focus
|
|
42754
|
+
* over. Filling the new editor from WYSIWYG instead would drop what was
|
|
42755
|
+
* typed since the last, debounced, sync and normalise half-typed markup.
|
|
42756
|
+
*/ takeOver(sourceEditor) {
|
|
42757
|
+
const previous = this.sourceEditor;
|
|
42758
|
+
if (!previous || previous === sourceEditor) {
|
|
42759
|
+
this.sourceEditor = sourceEditor;
|
|
42760
|
+
this.syncValueFromWYSIWYG(true);
|
|
42761
|
+
return;
|
|
42762
|
+
}
|
|
42763
|
+
const value = previous.getValue(), start = previous.getSelectionStart(), end = previous.getSelectionEnd(), focused = previous.isFocused, untouched = value === this.__filledValue;
|
|
42764
|
+
previous.destruct();
|
|
42765
|
+
this.sourceEditor = sourceEditor;
|
|
42766
|
+
if (untouched) {
|
|
42767
|
+
this.syncValueFromWYSIWYG(true);
|
|
42768
|
+
} else {
|
|
42769
|
+
sourceEditor.setValue(value);
|
|
42770
|
+
this.toWYSIWYG();
|
|
42771
|
+
}
|
|
42772
|
+
if (start >= 0) {
|
|
42773
|
+
sourceEditor.setSelectionRange(start, end);
|
|
42774
|
+
}
|
|
42775
|
+
focused && sourceEditor.focus();
|
|
42776
|
+
}
|
|
42777
|
+
/**
|
|
42778
|
+
* The beautifier arrived after the source view was opened: format the
|
|
42779
|
+
* view if nothing has been typed into it, otherwise leave the typing alone
|
|
42780
|
+
*/ beautifyUntouched() {
|
|
42781
|
+
const value = this.getMirrorValue();
|
|
42782
|
+
if (this.j.o.editHTMLDocumentMode || !value || value !== this.__filledValue) {
|
|
42783
|
+
return;
|
|
42784
|
+
}
|
|
42785
|
+
const html = this.j.e.fire('beautifyHTML', value);
|
|
42786
|
+
if ((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.isString)(html) && html !== value) {
|
|
42787
|
+
const focused = this.sourceEditor?.isFocused;
|
|
42788
|
+
this.setMirrorValue(html);
|
|
42789
|
+
this.__filledValue = this.getMirrorValue();
|
|
42790
|
+
focused && this.sourceEditor?.focus();
|
|
42791
|
+
}
|
|
42792
|
+
}
|
|
42684
42793
|
/** @override */ beforeDestruct() {
|
|
42685
42794
|
if (this.sourceEditor) {
|
|
42686
42795
|
this.sourceEditor.destruct();
|
|
@@ -42694,7 +42803,10 @@ class SourceEditor {
|
|
|
42694
42803
|
name: 'source',
|
|
42695
42804
|
group: 'source'
|
|
42696
42805
|
}
|
|
42697
|
-
]), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "sourceEditor", void 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "mirrorContainer", void 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__lock", false), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__oldMirrorValue", ''),
|
|
42806
|
+
]), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "sourceEditor", void 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "mirrorContainer", void 0), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__lock", false), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__oldMirrorValue", ''), /**
|
|
42807
|
+
* What the source view was last filled with from WYSIWYG, read back from
|
|
42808
|
+
* the editor; while the view still holds it, nothing has been typed there
|
|
42809
|
+
*/ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__filledValue", ''), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "tempMarkerStart", '{start-jodit-selection}'), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "tempMarkerStartReg", /{start-jodit-selection}/g), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "tempMarkerEnd", '{end-jodit-selection}'), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "tempMarkerEndReg", /{end-jodit-selection}/g), // override it for ace editors
|
|
42698
42810
|
(0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "getSelectionStart", ()=>{
|
|
42699
42811
|
return this.sourceEditor?.getSelectionStart() ?? 0;
|
|
42700
42812
|
}), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "getSelectionEnd", ()=>{
|
|
@@ -45058,10 +45170,19 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_5__.pluginSystem.add('toolbarNavigati
|
|
|
45058
45170
|
|
|
45059
45171
|
|
|
45060
45172
|
|
|
45173
|
+
function insertVideos(data) {
|
|
45174
|
+
data.files?.forEach((file)=>{
|
|
45175
|
+
this.s.insertNode(this.createInside.element('video', {
|
|
45176
|
+
controls: '',
|
|
45177
|
+
src: data.baseurl + file
|
|
45178
|
+
}));
|
|
45179
|
+
});
|
|
45180
|
+
}
|
|
45061
45181
|
jodit_config__WEBPACK_IMPORTED_MODULE_4__.Config.prototype.video = {
|
|
45062
45182
|
parseUrlToVideoEmbed: jodit_core_helpers__WEBPACK_IMPORTED_MODULE_0__.convertMediaUrlToVideoEmbed,
|
|
45063
45183
|
defaultWidth: 400,
|
|
45064
|
-
defaultHeight: 345
|
|
45184
|
+
defaultHeight: 345,
|
|
45185
|
+
defaultHandlerSuccess: insertVideos
|
|
45065
45186
|
};
|
|
45066
45187
|
jodit_core_ui_icon__WEBPACK_IMPORTED_MODULE_3__.Icon.set('video', (_video_svg__WEBPACK_IMPORTED_MODULE_6___default()));
|
|
45067
45188
|
jodit_config__WEBPACK_IMPORTED_MODULE_4__.Config.prototype.controls.video = {
|
|
@@ -45098,6 +45219,17 @@ jodit_config__WEBPACK_IMPORTED_MODULE_4__.Config.prototype.controls.video = {
|
|
|
45098
45219
|
close();
|
|
45099
45220
|
};
|
|
45100
45221
|
jodit.s.save();
|
|
45222
|
+
const { uploader } = jodit.o;
|
|
45223
|
+
// Base64 alone would put whole video files into the content
|
|
45224
|
+
if (uploader.showTabInFileSelector !== false && (uploader.url || uploader.customUploadFunction)) {
|
|
45225
|
+
tabs.push((0,jodit_modules_widget__WEBPACK_IMPORTED_MODULE_5__.UploadTab)(jodit, (data)=>{
|
|
45226
|
+
jodit.s.restore();
|
|
45227
|
+
(jodit.o.video?.defaultHandlerSuccess ?? insertVideos).call(jodit, data);
|
|
45228
|
+
}, {
|
|
45229
|
+
label: 'Drop file',
|
|
45230
|
+
accept: 'video/*'
|
|
45231
|
+
}));
|
|
45232
|
+
}
|
|
45101
45233
|
tabs.push({
|
|
45102
45234
|
icon: 'link',
|
|
45103
45235
|
name: 'Link',
|