jodit 4.17.5 → 4.17.6
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 +10 -0
- package/es2015/jodit.css +1 -1
- package/es2015/jodit.fat.min.js +5 -5
- package/es2015/jodit.js +86 -35
- package/es2015/jodit.min.js +5 -5
- 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 +5 -5
- package/es2018/jodit.min.js +5 -5
- 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 +7 -7
- package/es2021/jodit.js +84 -35
- package/es2021/jodit.min.js +7 -7
- 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 +7 -7
- package/es2021.en/jodit.js +84 -35
- 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 +89 -35
- 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/core/constants.js +1 -1
- package/esm/core/selection/selection.js +31 -5
- package/esm/modules/history/history.js +20 -12
- package/esm/plugins/line-height/line-height.js +1 -1
- package/esm/plugins/placeholder/placeholder.js +1 -1
- package/esm/plugins/source/editor/engines/ace.d.ts +2 -0
- package/esm/plugins/source/editor/engines/ace.js +35 -3
- package/package.json +1 -1
- package/types/plugins/source/editor/engines/ace.d.ts +2 -0
package/es2021.en/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.17.
|
|
4
|
+
* Version: v4.17.6
|
|
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.17.
|
|
1802
|
+
*/ const APP_VERSION = "4.17.6";
|
|
1803
1803
|
// prettier-ignore
|
|
1804
1804
|
const ES = "es2021";
|
|
1805
1805
|
const IS_ES_MODERN = true;
|
|
@@ -10845,6 +10845,11 @@ function findCorrectCurrentNode(node, range, rightMode, isCollapsed, checkChild,
|
|
|
10845
10845
|
|
|
10846
10846
|
|
|
10847
10847
|
|
|
10848
|
+
/**
|
|
10849
|
+
* A text node that is empty or holds only invisible caret placeholders.
|
|
10850
|
+
*/ function isBlankTextNode(node) {
|
|
10851
|
+
return jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isText(node) && (node.nodeValue ?? '').replace(jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.INVISIBLE_SPACE_REG_EXP(), '').length === 0;
|
|
10852
|
+
}
|
|
10848
10853
|
class Selection {
|
|
10849
10854
|
/**
|
|
10850
10855
|
* Short alias for this.jodit
|
|
@@ -11089,10 +11094,21 @@ class Selection {
|
|
|
11089
11094
|
jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.append(marker, this.j.createInside.text(jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.INVISIBLE_SPACE));
|
|
11090
11095
|
if (newRange) {
|
|
11091
11096
|
if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isOrContains(this.area, atStart ? newRange.startContainer : newRange.endContainer)) {
|
|
11092
|
-
|
|
11093
|
-
//
|
|
11094
|
-
//
|
|
11095
|
-
|
|
11097
|
+
const { startContainer: node, startOffset: offset } = newRange;
|
|
11098
|
+
// At either end of a text node the marker goes beside it. Splitting
|
|
11099
|
+
// the node there would leave the selection's boundary in an empty
|
|
11100
|
+
// text node, and WebKit neither repaints a selection that leaves one
|
|
11101
|
+
// nor moves a selection that follows one when it's removed.
|
|
11102
|
+
if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isText(node) && offset === 0) {
|
|
11103
|
+
jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.before(node, marker);
|
|
11104
|
+
} else if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isText(node) && offset === node.nodeValue?.length) {
|
|
11105
|
+
jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.after(node, marker);
|
|
11106
|
+
} else {
|
|
11107
|
+
// Here need do unsafe inserting
|
|
11108
|
+
// Deny Dom.safeInsertNode(newRange, marker);
|
|
11109
|
+
// Apply style -> Test Style module -> Base apply -> For selection <p><strong>|test|</strong></p> apply style {"element":"em","style":{"fontStyle":"italic"}}
|
|
11110
|
+
newRange.insertNode(marker);
|
|
11111
|
+
}
|
|
11096
11112
|
}
|
|
11097
11113
|
}
|
|
11098
11114
|
return marker;
|
|
@@ -11414,7 +11430,9 @@ class Selection {
|
|
|
11414
11430
|
()=>firstChild?.previousSibling?.lastChild
|
|
11415
11431
|
].forEach((getChildNode)=>{
|
|
11416
11432
|
const childNode = getChildNode();
|
|
11417
|
-
|
|
11433
|
+
// Only a text node left with nothing in it by the split
|
|
11434
|
+
// goes; one holding a space is content (`<b>a</b> |`).
|
|
11435
|
+
if (childNode && isBlankTextNode(childNode)) {
|
|
11418
11436
|
jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.safeRemove(childNode);
|
|
11419
11437
|
}
|
|
11420
11438
|
});
|
|
@@ -22294,19 +22312,27 @@ jodit_config__WEBPACK_IMPORTED_MODULE_4__.Config.prototype.history = {
|
|
|
22294
22312
|
* Update history stack
|
|
22295
22313
|
*/ updateStack(replace = false) {
|
|
22296
22314
|
const newValue = this.snapshot.make();
|
|
22297
|
-
if (
|
|
22298
|
-
|
|
22299
|
-
|
|
22300
|
-
|
|
22301
|
-
|
|
22302
|
-
|
|
22303
|
-
|
|
22304
|
-
} else {
|
|
22305
|
-
this.__stack.push(newCommand);
|
|
22306
|
-
}
|
|
22315
|
+
if (_snapshot__WEBPACK_IMPORTED_MODULE_6__.Snapshot.equal(newValue, this.startValue)) {
|
|
22316
|
+
return;
|
|
22317
|
+
}
|
|
22318
|
+
// Only the selection moved, for example when the selection markers
|
|
22319
|
+
// went in before a switch to the source view. There is nothing to
|
|
22320
|
+
// undo, but the next change has to start from this selection.
|
|
22321
|
+
if (newValue.html === this.startValue.html) {
|
|
22307
22322
|
this.startValue = newValue;
|
|
22308
|
-
|
|
22323
|
+
return;
|
|
22309
22324
|
}
|
|
22325
|
+
const newCommand = new _command__WEBPACK_IMPORTED_MODULE_5__.Command(this.startValue, newValue, this, this.updateTick);
|
|
22326
|
+
if (replace) {
|
|
22327
|
+
const command = this.__stack.current();
|
|
22328
|
+
if (command && this.updateTick === command.tick) {
|
|
22329
|
+
this.__stack.replace(newCommand);
|
|
22330
|
+
}
|
|
22331
|
+
} else {
|
|
22332
|
+
this.__stack.push(newCommand);
|
|
22333
|
+
}
|
|
22334
|
+
this.startValue = newValue;
|
|
22335
|
+
this.fireChangeStack();
|
|
22310
22336
|
}
|
|
22311
22337
|
fireChangeStack() {
|
|
22312
22338
|
this.j && !this.j.isInDestruct && this.j.events?.fire('changeStack');
|
|
@@ -36346,7 +36372,7 @@ class lineHeight extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_6__.Plugin {
|
|
|
36346
36372
|
try {
|
|
36347
36373
|
if (s.isCollapsed()) {
|
|
36348
36374
|
const fake = c.fake();
|
|
36349
|
-
s.
|
|
36375
|
+
jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.safeInsertNode(s.range, fake);
|
|
36350
36376
|
apply(fake);
|
|
36351
36377
|
jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.safeRemove(fake);
|
|
36352
36378
|
} else {
|
|
@@ -38369,7 +38395,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_0__.Config.prototype.useInputsPlaceholder
|
|
|
38369
38395
|
this.placeholderElm.innerHTML = (0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_7__.attr)(editor.element, 'placeholder') || '';
|
|
38370
38396
|
}
|
|
38371
38397
|
editor.e.fire('placeholder', this.placeholderElm.innerHTML);
|
|
38372
|
-
editor.e.off('.placeholder').on('changePlace.placeholder', this.addNativeListeners).on('change.placeholder focus.placeholder keyup.placeholder mouseup.placeholder keydown.placeholder ' + 'mousedown.placeholder afterSetMode.placeholder changePlace.placeholder ' + 'internalChange.placeholder', this.toggle).on(window, 'load', this.toggle);
|
|
38398
|
+
editor.e.off('.placeholder').on('changePlace.placeholder', this.addNativeListeners).on('change.placeholder focus.placeholder keyup.placeholder mouseup.placeholder keydown.placeholder ' + 'mousedown.placeholder afterSetMode.placeholder changePlace.placeholder ' + 'internalChange.placeholder afterCommand.placeholder', this.toggle).on(window, 'load', this.toggle);
|
|
38373
38399
|
this.addNativeListeners();
|
|
38374
38400
|
this.toggle();
|
|
38375
38401
|
});
|
|
@@ -41514,10 +41540,12 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.source = {
|
|
|
41514
41540
|
/* harmony export */ AceEditor: function() { return /* binding */ AceEditor; }
|
|
41515
41541
|
/* harmony export */ });
|
|
41516
41542
|
/* harmony import */ var _swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(25045);
|
|
41517
|
-
/* harmony import */ var
|
|
41518
|
-
/* harmony import */ var
|
|
41519
|
-
/* harmony import */ var
|
|
41520
|
-
/* harmony import */ var
|
|
41543
|
+
/* harmony import */ var _swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(31635);
|
|
41544
|
+
/* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(81937);
|
|
41545
|
+
/* harmony import */ var jodit_core_decorators_autobind_autobind__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(49574);
|
|
41546
|
+
/* harmony import */ var jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(23211);
|
|
41547
|
+
/* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(65946);
|
|
41548
|
+
/* harmony import */ var jodit_plugins_source_editor_sourceEditor__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(94193);
|
|
41521
41549
|
/*!
|
|
41522
41550
|
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
41523
41551
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
@@ -41529,7 +41557,9 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.source = {
|
|
|
41529
41557
|
|
|
41530
41558
|
|
|
41531
41559
|
|
|
41532
|
-
|
|
41560
|
+
|
|
41561
|
+
|
|
41562
|
+
class AceEditor extends jodit_plugins_source_editor_sourceEditor__WEBPACK_IMPORTED_MODULE_6__.SourceEditor {
|
|
41533
41563
|
aceExists() {
|
|
41534
41564
|
return this.j.ow.ace !== undefined;
|
|
41535
41565
|
}
|
|
@@ -41587,7 +41617,7 @@ class AceEditor extends jodit_plugins_source_editor_sourceEditor__WEBPACK_IMPORT
|
|
|
41587
41617
|
return;
|
|
41588
41618
|
}
|
|
41589
41619
|
const fakeMirror = this.j.c.div('jodit-source__mirror-fake');
|
|
41590
|
-
|
|
41620
|
+
jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.append(this.container, fakeMirror);
|
|
41591
41621
|
const ace = editor.ow.ace;
|
|
41592
41622
|
this.instance = ace.edit(fakeMirror);
|
|
41593
41623
|
if (editor.o.direction === 'rtl') {
|
|
@@ -41608,15 +41638,15 @@ class AceEditor extends jodit_plugins_source_editor_sourceEditor__WEBPACK_IMPORT
|
|
|
41608
41638
|
this.instance.setOption('wrap', editor.o.sourceEditorNativeOptions.wrap);
|
|
41609
41639
|
this.instance.getSession().setUseWorker(false);
|
|
41610
41640
|
this.instance.$blockScrolling = Infinity;
|
|
41611
|
-
this.instance.on('change', this.
|
|
41641
|
+
this.instance.on('change', this.__onChange);
|
|
41612
41642
|
this.instance.on('focus', this.proxyOnFocus);
|
|
41613
41643
|
this.instance.on('mousedown', this.proxyOnMouseDown);
|
|
41614
41644
|
this.instance.on('blur', this.proxyOnBlur);
|
|
41615
|
-
if (editor.getRealMode() !==
|
|
41645
|
+
if (editor.getRealMode() !== jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.MODE_WYSIWYG) {
|
|
41616
41646
|
this.setValue(this.getValue());
|
|
41617
41647
|
}
|
|
41618
41648
|
const onResize = this.j.async.throttle(()=>{
|
|
41619
|
-
if (editor.isInDestruct || editor.getMode() ===
|
|
41649
|
+
if (editor.isInDestruct || editor.getMode() === jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.MODE_WYSIWYG) {
|
|
41620
41650
|
return;
|
|
41621
41651
|
}
|
|
41622
41652
|
const hasFocus = this.instance.isFocused();
|
|
@@ -41634,7 +41664,7 @@ class AceEditor extends jodit_plugins_source_editor_sourceEditor__WEBPACK_IMPORT
|
|
|
41634
41664
|
};
|
|
41635
41665
|
let loading = false;
|
|
41636
41666
|
const initAceEditor = ()=>{
|
|
41637
|
-
if (editor.isInDestruct || editor.getRealMode() !==
|
|
41667
|
+
if (editor.isInDestruct || editor.getRealMode() !== jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.MODE_SOURCE && editor.getMode() !== jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.MODE_SPLIT) {
|
|
41638
41668
|
return;
|
|
41639
41669
|
}
|
|
41640
41670
|
// ACE (~400 KiB from the CDN) is only needed once the source view
|
|
@@ -41643,7 +41673,7 @@ class AceEditor extends jodit_plugins_source_editor_sourceEditor__WEBPACK_IMPORT
|
|
|
41643
41673
|
if (!this.aceExists()) {
|
|
41644
41674
|
if (!loading) {
|
|
41645
41675
|
loading = true;
|
|
41646
|
-
(0,
|
|
41676
|
+
(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.loadNext)(editor, editor.o.sourceEditorCDNUrlsJS).then(initAceEditor).catch(()=>null);
|
|
41647
41677
|
}
|
|
41648
41678
|
return;
|
|
41649
41679
|
}
|
|
@@ -41655,7 +41685,7 @@ class AceEditor extends jodit_plugins_source_editor_sourceEditor__WEBPACK_IMPORT
|
|
|
41655
41685
|
initAceEditor();
|
|
41656
41686
|
}
|
|
41657
41687
|
destruct() {
|
|
41658
|
-
this.instance.off('change', this.
|
|
41688
|
+
this.instance.off('change', this.__onChange);
|
|
41659
41689
|
this.instance.off('focus', this.proxyOnFocus);
|
|
41660
41690
|
this.instance.off('mousedown', this.proxyOnMouseDown);
|
|
41661
41691
|
this.instance.destroy();
|
|
@@ -41664,13 +41694,29 @@ class AceEditor extends jodit_plugins_source_editor_sourceEditor__WEBPACK_IMPORT
|
|
|
41664
41694
|
setValue(value) {
|
|
41665
41695
|
if (!this.j.o.editHTMLDocumentMode && this.j.o.beautifyHTML) {
|
|
41666
41696
|
const html = this.j.e.fire('beautifyHTML', value);
|
|
41667
|
-
if ((0,
|
|
41697
|
+
if ((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_5__.isString)(html)) {
|
|
41668
41698
|
value = html;
|
|
41669
41699
|
}
|
|
41670
41700
|
}
|
|
41671
|
-
|
|
41701
|
+
// ACE reports its own `setValue` as two changes, the removal of the
|
|
41702
|
+
// old text and the insertion of the new one. Fed back into the
|
|
41703
|
+
// editor they became two history entries, `content -> ''` and
|
|
41704
|
+
// `'' -> content`, so the first undo after a switch to the source
|
|
41705
|
+
// view and back emptied the editor. The text came from the editor
|
|
41706
|
+
// in the first place, so there is nothing to send back.
|
|
41707
|
+
this.__settingValue = true;
|
|
41708
|
+
try {
|
|
41709
|
+
this.instance.setValue(value);
|
|
41710
|
+
} finally{
|
|
41711
|
+
this.__settingValue = false;
|
|
41712
|
+
}
|
|
41672
41713
|
this.instance.clearSelection();
|
|
41673
41714
|
}
|
|
41715
|
+
__onChange() {
|
|
41716
|
+
if (!this.__settingValue) {
|
|
41717
|
+
this.toWYSIWYG();
|
|
41718
|
+
}
|
|
41719
|
+
}
|
|
41674
41720
|
getValue() {
|
|
41675
41721
|
return this.instance.getValue();
|
|
41676
41722
|
}
|
|
@@ -41744,9 +41790,12 @@ class AceEditor extends jodit_plugins_source_editor_sourceEditor__WEBPACK_IMPORT
|
|
|
41744
41790
|
this.j.e.fire('focus', e);
|
|
41745
41791
|
}), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "proxyOnMouseDown", (e)=>{
|
|
41746
41792
|
this.j.e.fire('mousedown', e);
|
|
41747
|
-
});
|
|
41793
|
+
}), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__settingValue", false);
|
|
41748
41794
|
}
|
|
41749
41795
|
}
|
|
41796
|
+
;(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
41797
|
+
jodit_core_decorators_autobind_autobind__WEBPACK_IMPORTED_MODULE_3__.autobind
|
|
41798
|
+
], AceEditor.prototype, "__onChange", null);
|
|
41750
41799
|
|
|
41751
41800
|
|
|
41752
41801
|
/***/ }),
|