jodit 4.20.4 → 4.20.5
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 +8 -0
- package/es2015/jodit.css +1 -1
- package/es2015/jodit.fat.min.js +4 -4
- package/es2015/jodit.js +72 -27
- package/es2015/jodit.min.js +4 -4
- 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 +4 -4
- package/es2018/jodit.min.js +4 -4
- 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 +4 -4
- package/es2021/jodit.js +72 -27
- package/es2021/jodit.min.js +4 -4
- 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 +6 -6
- package/es2021.en/jodit.js +72 -27
- package/es2021.en/jodit.min.js +4 -4
- 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 +93 -26
- 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 +2 -0
- package/esm/core/constants.js +1 -1
- package/esm/plugins/clean-html/clean-html.d.ts +1 -0
- package/esm/plugins/clean-html/clean-html.js +15 -0
- package/esm/plugins/file/file.js +12 -1
- package/esm/plugins/link/config.d.ts +2 -0
- package/esm/plugins/link/config.js +1 -0
- package/esm/plugins/link/link.js +49 -23
- package/esm/plugins/link/template.js +4 -4
- package/package.json +1 -1
- package/types/config.d.ts +2 -0
- package/types/plugins/clean-html/clean-html.d.ts +1 -0
- package/types/plugins/link/config.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.20.
|
|
4
|
+
* Version: v4.20.5
|
|
5
5
|
* Url: https://xdsoft.net/jodit/
|
|
6
6
|
* License(s): MIT
|
|
7
7
|
*/
|
|
@@ -1824,7 +1824,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1824
1824
|
* ```
|
|
1825
1825
|
* @packageDocumentation
|
|
1826
1826
|
* @module constants
|
|
1827
|
-
*/ const APP_VERSION = "4.20.
|
|
1827
|
+
*/ const APP_VERSION = "4.20.5";
|
|
1828
1828
|
// prettier-ignore
|
|
1829
1829
|
const ES = "es2021";
|
|
1830
1830
|
const IS_ES_MODERN = true;
|
|
@@ -31747,8 +31747,18 @@ class cleanHtml extends jodit_core_plugin_plugin__WEBPACK_IMPORTED_MODULE_7__.Pl
|
|
|
31747
31747
|
}
|
|
31748
31748
|
;(0,jodit_core_helpers_html_safe_html__WEBPACK_IMPORTED_MODULE_6__.safeHTML)(sandBox, this.j.o.cleanHTML);
|
|
31749
31749
|
}
|
|
31750
|
+
onCleanHTML(sandBox) {
|
|
31751
|
+
const allow = (0,_helpers__WEBPACK_IMPORTED_MODULE_10__.getHash)(this.j.o.cleanHTML.allowTags);
|
|
31752
|
+
const deny = (0,_helpers__WEBPACK_IMPORTED_MODULE_10__.getHash)(this.j.o.cleanHTML.denyTags);
|
|
31753
|
+
const nodes = Array.from(sandBox.querySelectorAll('*'));
|
|
31754
|
+
for (const node of nodes){
|
|
31755
|
+
if (jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.isOrContains(sandBox, node)) {
|
|
31756
|
+
(0,_helpers__WEBPACK_IMPORTED_MODULE_10__.visitNodeWalker)(this.j, node, allow, deny, null);
|
|
31757
|
+
}
|
|
31758
|
+
}
|
|
31759
|
+
}
|
|
31750
31760
|
/** @override */ beforeDestruct() {
|
|
31751
|
-
this.j.e.off('safeHTML', this.onSafeHTML).off('beforeSetNativeEditorValue', this.onBeforeSetNativeEditorValue).off('afterSetNativeEditorValue', this.onAfterSetNativeEditorValue);
|
|
31761
|
+
this.j.e.off('safeHTML', this.onSafeHTML).off('cleanHTML', this.onCleanHTML).off('beforeSetNativeEditorValue', this.onBeforeSetNativeEditorValue).off('afterSetNativeEditorValue', this.onAfterSetNativeEditorValue);
|
|
31752
31762
|
this.walker.destruct();
|
|
31753
31763
|
}
|
|
31754
31764
|
constructor(jodit){
|
|
@@ -31765,7 +31775,7 @@ class cleanHtml extends jodit_core_plugin_plugin__WEBPACK_IMPORTED_MODULE_7__.Pl
|
|
|
31765
31775
|
// markup out of the live tree have to be there from the start, or
|
|
31766
31776
|
// event handlers in a textarea's content run before anything
|
|
31767
31777
|
// sanitises them.
|
|
31768
|
-
jodit.e.on('safeHTML', this.onSafeHTML).on('beforeSetNativeEditorValue', this.onBeforeSetNativeEditorValue).on('afterSetNativeEditorValue', this.onAfterSetNativeEditorValue);
|
|
31778
|
+
jodit.e.on('safeHTML', this.onSafeHTML).on('cleanHTML', this.onCleanHTML).on('beforeSetNativeEditorValue', this.onBeforeSetNativeEditorValue).on('afterSetNativeEditorValue', this.onAfterSetNativeEditorValue);
|
|
31769
31779
|
}
|
|
31770
31780
|
}
|
|
31771
31781
|
;(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__._)([
|
|
@@ -31801,6 +31811,9 @@ class cleanHtml extends jodit_core_plugin_plugin__WEBPACK_IMPORTED_MODULE_7__.Pl
|
|
|
31801
31811
|
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__._)([
|
|
31802
31812
|
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_2__.autobind
|
|
31803
31813
|
], cleanHtml.prototype, "onSafeHTML", null);
|
|
31814
|
+
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__._)([
|
|
31815
|
+
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_2__.autobind
|
|
31816
|
+
], cleanHtml.prototype, "onCleanHTML", null);
|
|
31804
31817
|
jodit_core_global__WEBPACK_IMPORTED_MODULE_5__.pluginSystem.add('cleanHtml', cleanHtml);
|
|
31805
31818
|
|
|
31806
31819
|
|
|
@@ -35318,14 +35331,25 @@ jodit_config__WEBPACK_IMPORTED_MODULE_3__.Config.prototype.controls.file = {
|
|
|
35318
35331
|
popup: (editor, current, close)=>{
|
|
35319
35332
|
// The popup's first field takes the focus, so the selection the
|
|
35320
35333
|
// popup was opened for is kept and put back before the link goes in
|
|
35321
|
-
|
|
35334
|
+
let selected = editor.s.isCollapsed() ? null : editor.s.range;
|
|
35322
35335
|
const restoreSelection = ()=>{
|
|
35323
35336
|
if (selected) {
|
|
35324
35337
|
editor.s.selectRange(selected);
|
|
35338
|
+
selected = null;
|
|
35325
35339
|
}
|
|
35326
35340
|
};
|
|
35327
35341
|
const insert = (url, title = '')=>{
|
|
35328
35342
|
restoreSelection();
|
|
35343
|
+
if (sourceAnchor && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_0__.Dom.isOrContains(editor.editor, sourceAnchor)) {
|
|
35344
|
+
(0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_2__.attr)(sourceAnchor, 'href', url);
|
|
35345
|
+
if (title) {
|
|
35346
|
+
(0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_2__.attr)(sourceAnchor, 'title', title);
|
|
35347
|
+
}
|
|
35348
|
+
editor.s.setCursorAfter(sourceAnchor);
|
|
35349
|
+
sourceAnchor = null;
|
|
35350
|
+
editor.synchronizeValues();
|
|
35351
|
+
return;
|
|
35352
|
+
}
|
|
35329
35353
|
if (wrapSelectionInLink(editor, url, title)) {
|
|
35330
35354
|
return;
|
|
35331
35355
|
}
|
|
@@ -41643,6 +41667,7 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_4__.pluginSystem.add('lineHeight', li
|
|
|
41643
41667
|
|
|
41644
41668
|
jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.link = {
|
|
41645
41669
|
formTemplate: jodit_plugins_link_template__WEBPACK_IMPORTED_MODULE_5__.formTemplate,
|
|
41670
|
+
contentMode: 'text',
|
|
41646
41671
|
followOnDblClick: false,
|
|
41647
41672
|
processVideoLink: true,
|
|
41648
41673
|
processPastedLink: true,
|
|
@@ -41823,7 +41848,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
41823
41848
|
__generateForm(current, close) {
|
|
41824
41849
|
const { jodit } = this;
|
|
41825
41850
|
const i18n = jodit.i18n.bind(jodit);
|
|
41826
|
-
const { openInNewTabCheckbox, openInNewTabCheckboxDefaultChecked, noFollowCheckbox, formTemplate, formClassName, modeClassName } = jodit.o.link;
|
|
41851
|
+
const { openInNewTabCheckbox, openInNewTabCheckboxDefaultChecked, noFollowCheckbox, formTemplate, formClassName, modeClassName, contentMode } = jodit.o.link;
|
|
41827
41852
|
const html = formTemplate(jodit);
|
|
41828
41853
|
const form = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.isString)(html) ? jodit.c.fromHTML(html, {
|
|
41829
41854
|
target_checkbox_box: openInNewTabCheckbox,
|
|
@@ -41834,7 +41859,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
41834
41859
|
const { insert, unlink, content_input_box } = elements;
|
|
41835
41860
|
const { target_checkbox, nofollow_checkbox, url_input } = elements;
|
|
41836
41861
|
const currentElement = current;
|
|
41837
|
-
const isImageContent = jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isImage(currentElement);
|
|
41862
|
+
const isImageContent = contentMode !== 'html' && jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isImage(currentElement);
|
|
41838
41863
|
let { content_input } = elements;
|
|
41839
41864
|
const { className_input } = elements, { className_select } = elements, { aria_label_input } = elements;
|
|
41840
41865
|
if (!content_input) {
|
|
@@ -41850,15 +41875,21 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
41850
41875
|
jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.hide(content_input_box);
|
|
41851
41876
|
}
|
|
41852
41877
|
let link;
|
|
41853
|
-
const
|
|
41878
|
+
const getSelectionContent = ()=>{
|
|
41879
|
+
if (contentMode === 'html') {
|
|
41880
|
+
return link ? link.innerHTML : jodit.s.html;
|
|
41881
|
+
}
|
|
41882
|
+
return link ? link.innerText : (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.stripTags)(jodit.s.range.cloneContents(), jodit.ed);
|
|
41883
|
+
};
|
|
41854
41884
|
if (current && jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.closest(current, 'a', jodit.editor)) {
|
|
41855
41885
|
link = jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.closest(current, 'a', jodit.editor);
|
|
41856
41886
|
} else {
|
|
41857
41887
|
link = false;
|
|
41858
41888
|
}
|
|
41859
41889
|
if (!isImageContent && current) {
|
|
41860
|
-
content_input.value =
|
|
41890
|
+
content_input.value = getSelectionContent();
|
|
41861
41891
|
}
|
|
41892
|
+
const initialContent = content_input.value;
|
|
41862
41893
|
if (aria_label_input) {
|
|
41863
41894
|
aria_label_input.value = link ? (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(link, 'aria-label') || '' : '';
|
|
41864
41895
|
}
|
|
@@ -41877,7 +41908,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
41877
41908
|
} else {
|
|
41878
41909
|
jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.hide(unlink);
|
|
41879
41910
|
if (jodit.o.link.deriveUrlFromText && url_input && !isImageContent && !url_input.value.trim()) {
|
|
41880
|
-
url_input.value = guessUrlFromText(content_input.value);
|
|
41911
|
+
url_input.value = guessUrlFromText(contentMode === 'html' ? (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.stripTags)(content_input.value, jodit.ed) : content_input.value);
|
|
41881
41912
|
}
|
|
41882
41913
|
if (openInNewTabCheckbox && target_checkbox) {
|
|
41883
41914
|
target_checkbox.checked = openInNewTabCheckboxDefaultChecked;
|
|
@@ -41909,7 +41940,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
41909
41940
|
jodit.s.removeMarkers();
|
|
41910
41941
|
jodit.editor.normalize();
|
|
41911
41942
|
jodit.history.snapshot.restore(snapshot);
|
|
41912
|
-
const
|
|
41943
|
+
const contentWasChanged = initialContent !== content_input.value;
|
|
41913
41944
|
const ci = jodit.createInside;
|
|
41914
41945
|
let caretAfter = null;
|
|
41915
41946
|
if (!link || !jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isOrContains(jodit.editor, link)) {
|
|
@@ -41940,7 +41971,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
41940
41971
|
;(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'href', url_input.value);
|
|
41941
41972
|
writeClasses(modeClassName, className_input, className_select, a);
|
|
41942
41973
|
if (!isImageContent) {
|
|
41943
|
-
|
|
41974
|
+
writeContent(jodit, a, content_input.value, contentWasChanged, url_input.value, contentMode);
|
|
41944
41975
|
}
|
|
41945
41976
|
if (openInNewTabCheckbox && target_checkbox) {
|
|
41946
41977
|
(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'target', target_checkbox.checked ? '_blank' : null);
|
|
@@ -42211,7 +42242,7 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_5__.pluginSystem.add('link', link);
|
|
|
42211
42242
|
dropdown.close();
|
|
42212
42243
|
url.value = '#' + name;
|
|
42213
42244
|
if (!isImage && (!content.value.trim() || content.value === filled)) {
|
|
42214
|
-
content.value = filled = text;
|
|
42245
|
+
content.value = filled = jodit.o.link.contentMode === 'html' ? (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.htmlspecialchars)(text) : text;
|
|
42215
42246
|
}
|
|
42216
42247
|
url.focus();
|
|
42217
42248
|
});
|
|
@@ -42344,19 +42375,33 @@ function readClassnames(modeClassName, className_input, link, className_select)
|
|
|
42344
42375
|
break;
|
|
42345
42376
|
}
|
|
42346
42377
|
}
|
|
42347
|
-
function
|
|
42348
|
-
|
|
42349
|
-
|
|
42350
|
-
if (textWasChanged) {
|
|
42351
|
-
newContent = content_input.value;
|
|
42352
|
-
}
|
|
42353
|
-
} else {
|
|
42354
|
-
newContent = url_input.value;
|
|
42378
|
+
function writeContent(editor, anchor, value, changed, url, mode) {
|
|
42379
|
+
if (!changed && anchor.hasChildNodes()) {
|
|
42380
|
+
return;
|
|
42355
42381
|
}
|
|
42356
|
-
|
|
42357
|
-
|
|
42358
|
-
|
|
42382
|
+
if (mode === 'text' || !value.trim()) {
|
|
42383
|
+
anchor.textContent = value.trim() ? value : url;
|
|
42384
|
+
return;
|
|
42359
42385
|
}
|
|
42386
|
+
const sandboxDocument = editor.od.implementation.createHTMLDocument('');
|
|
42387
|
+
const sandbox = sandboxDocument.createElement('div');
|
|
42388
|
+
sandbox.innerHTML = value;
|
|
42389
|
+
editor.e.fire('safeHTML', sandbox);
|
|
42390
|
+
sanitizeLinkHTML(sandbox);
|
|
42391
|
+
sandboxDocument.body.appendChild(sandbox);
|
|
42392
|
+
editor.e.fire('cleanHTML', sandbox);
|
|
42393
|
+
sanitizeLinkHTML(sandbox);
|
|
42394
|
+
sandbox.querySelectorAll('a').forEach((link)=>jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.unwrap(link));
|
|
42395
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.detach(anchor);
|
|
42396
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.moveContent(sandbox, anchor);
|
|
42397
|
+
}
|
|
42398
|
+
function sanitizeLinkHTML(sandbox) {
|
|
42399
|
+
sandbox.querySelectorAll('script,style,iframe,frame,frameset,object,embed,base,link,meta,template').forEach((node)=>jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.safeRemove(node));
|
|
42400
|
+
(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.safeHTML)(sandbox, {
|
|
42401
|
+
removeEventAttributes: true,
|
|
42402
|
+
removeOnError: true,
|
|
42403
|
+
safeJavaScriptLink: true
|
|
42404
|
+
});
|
|
42360
42405
|
}
|
|
42361
42406
|
|
|
42362
42407
|
|
|
@@ -42377,7 +42422,7 @@ function writeImage(a, content_input, textWasChanged, url_input) {
|
|
|
42377
42422
|
*/
|
|
42378
42423
|
|
|
42379
42424
|
const formTemplate = (editor)=>{
|
|
42380
|
-
const { openInNewTabCheckbox, noFollowCheckbox, ariaLabelInput, modeClassName, selectSizeClassName, selectMultipleClassName, selectOptionsClassName } = editor.o.link;
|
|
42425
|
+
const { openInNewTabCheckbox, noFollowCheckbox, ariaLabelInput, modeClassName, contentMode, selectSizeClassName, selectMultipleClassName, selectOptionsClassName } = editor.o.link;
|
|
42381
42426
|
return new jodit_core_ui_form__WEBPACK_IMPORTED_MODULE_1__.UIForm(editor, [
|
|
42382
42427
|
new jodit_core_ui_form__WEBPACK_IMPORTED_MODULE_1__.UIBlock(editor, [
|
|
42383
42428
|
new jodit_core_ui_form__WEBPACK_IMPORTED_MODULE_1__.UIInput(editor, {
|
|
@@ -42399,10 +42444,10 @@ const formTemplate = (editor)=>{
|
|
|
42399
42444
|
})
|
|
42400
42445
|
]) : null,
|
|
42401
42446
|
new jodit_core_ui_form__WEBPACK_IMPORTED_MODULE_1__.UIBlock(editor, [
|
|
42402
|
-
new jodit_core_ui_form__WEBPACK_IMPORTED_MODULE_1__.UIInput(editor, {
|
|
42447
|
+
new (contentMode === 'html' ? jodit_core_ui_form__WEBPACK_IMPORTED_MODULE_1__.UITextArea : jodit_core_ui_form__WEBPACK_IMPORTED_MODULE_1__.UIInput)(editor, {
|
|
42403
42448
|
name: 'content',
|
|
42404
42449
|
ref: 'content_input',
|
|
42405
|
-
label: 'Text'
|
|
42450
|
+
label: contentMode === 'html' ? 'HTML' : 'Text'
|
|
42406
42451
|
})
|
|
42407
42452
|
], {
|
|
42408
42453
|
ref: 'content_input_box'
|