jodit 4.19.4 → 4.19.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 +16 -0
- package/es2015/jodit.css +1 -1
- package/es2015/jodit.fat.min.js +20 -7
- package/es2015/jodit.js +393 -56
- package/es2015/jodit.min.js +17 -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 +17 -4
- package/es2018/jodit.min.js +17 -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 +18 -5
- package/es2021/jodit.js +390 -56
- package/es2021/jodit.min.js +18 -5
- 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 +20 -7
- package/es2021.en/jodit.js +390 -56
- package/es2021.en/jodit.min.js +20 -7
- 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 +410 -62
- 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 +31 -0
- package/esm/core/constants.js +1 -1
- package/esm/core/selection/helpers/move-node-inside-start.js +5 -2
- package/esm/plugins/file/file.js +39 -3
- package/esm/plugins/link/config.d.ts +31 -0
- package/esm/plugins/link/config.js +3 -0
- package/esm/plugins/link/link.d.ts +27 -0
- package/esm/plugins/link/link.js +144 -2
- package/esm/plugins/link/tlds.d.ts +18 -0
- package/esm/plugins/link/tlds.js +33 -0
- package/esm/plugins/link/typed-link.d.ts +23 -0
- package/esm/plugins/link/typed-link.js +92 -0
- package/package.json +1 -1
- package/types/config.d.ts +31 -0
- package/types/plugins/link/config.d.ts +31 -0
- package/types/plugins/link/link.d.ts +27 -0
- package/types/plugins/link/tlds.d.ts +18 -0
- package/types/plugins/link/typed-link.d.ts +23 -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.19.
|
|
4
|
+
* Version: v4.19.6
|
|
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.19.
|
|
1827
|
+
*/ const APP_VERSION = "4.19.6";
|
|
1828
1828
|
// prettier-ignore
|
|
1829
1829
|
const ES = "es2021";
|
|
1830
1830
|
const IS_ES_MODERN = true;
|
|
@@ -11222,7 +11222,10 @@ function findCorrectCurrentNode(node, range, rightMode, isCollapsed, checkChild,
|
|
|
11222
11222
|
* When the cursor is positioned in its place, it must be inside the element and not outside its border.
|
|
11223
11223
|
* @private
|
|
11224
11224
|
*/ function moveNodeInsideStart(j, node, start) {
|
|
11225
|
-
|
|
11225
|
+
// A text node of non-breaking spaces trims to nothing, but it's text the
|
|
11226
|
+
// node mustn't move past
|
|
11227
|
+
const isContent = (n)=>!jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isEmptyTextNode(n) || Boolean(n.nodeValue?.includes(jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.NBSP_SPACE));
|
|
11228
|
+
let sibling = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.findSibling(node, start, isContent), anotherSibling = jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.findSibling(node, !start, isContent);
|
|
11226
11229
|
while(jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isElement(sibling) && !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isTag(sibling, jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.INSEPARABLE_TAGS) && jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isContentEditable(sibling, j.editor) && (!anotherSibling || !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.closest(node, jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isElement, j.editor))){
|
|
11227
11230
|
if (start || !sibling.firstChild) {
|
|
11228
11231
|
jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.append(sibling, node);
|
|
@@ -33627,10 +33630,34 @@ function brBefore(start) {
|
|
|
33627
33630
|
|
|
33628
33631
|
|
|
33629
33632
|
|
|
33633
|
+
/**
|
|
33634
|
+
* Selected text becomes the link's text, as the Link button does, instead
|
|
33635
|
+
* of being replaced by the file's name. Returns false with nothing selected
|
|
33636
|
+
*/ function wrapSelectionInLink(editor, href, title = '') {
|
|
33637
|
+
if (editor.s.isCollapsed()) {
|
|
33638
|
+
return false;
|
|
33639
|
+
}
|
|
33640
|
+
const links = editor.s.wrapInTag('a');
|
|
33641
|
+
if (!links.length) {
|
|
33642
|
+
return false;
|
|
33643
|
+
}
|
|
33644
|
+
links.forEach((link)=>{
|
|
33645
|
+
;(0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_2__.attr)(link, 'href', href);
|
|
33646
|
+
if (title) {
|
|
33647
|
+
(0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_2__.attr)(link, 'title', title);
|
|
33648
|
+
}
|
|
33649
|
+
});
|
|
33650
|
+
editor.s.setCursorAfter(links[links.length - 1]);
|
|
33651
|
+
return true;
|
|
33652
|
+
}
|
|
33630
33653
|
function insertLinks(data) {
|
|
33631
33654
|
data.files?.forEach((file)=>{
|
|
33655
|
+
const href = data.baseurl + file;
|
|
33656
|
+
if (wrapSelectionInLink(this, href)) {
|
|
33657
|
+
return;
|
|
33658
|
+
}
|
|
33632
33659
|
const link = this.createInside.element('a', {
|
|
33633
|
-
href
|
|
33660
|
+
href
|
|
33634
33661
|
});
|
|
33635
33662
|
link.textContent = this.o.uploader.getDisplayName.call(this.uploader, data.baseurl, file);
|
|
33636
33663
|
this.s.insertNode(link);
|
|
@@ -33641,7 +33668,19 @@ jodit_config__WEBPACK_IMPORTED_MODULE_3__.Config.prototype.file = {
|
|
|
33641
33668
|
};
|
|
33642
33669
|
jodit_config__WEBPACK_IMPORTED_MODULE_3__.Config.prototype.controls.file = {
|
|
33643
33670
|
popup: (editor, current, close)=>{
|
|
33671
|
+
// The popup's first field takes the focus, so the selection the
|
|
33672
|
+
// popup was opened for is kept and put back before the link goes in
|
|
33673
|
+
const selected = editor.s.isCollapsed() ? null : editor.s.range;
|
|
33674
|
+
const restoreSelection = ()=>{
|
|
33675
|
+
if (selected) {
|
|
33676
|
+
editor.s.selectRange(selected);
|
|
33677
|
+
}
|
|
33678
|
+
};
|
|
33644
33679
|
const insert = (url, title = '')=>{
|
|
33680
|
+
restoreSelection();
|
|
33681
|
+
if (wrapSelectionInLink(editor, url, title)) {
|
|
33682
|
+
return;
|
|
33683
|
+
}
|
|
33645
33684
|
editor.s.insertNode(editor.createInside.fromHTML(`<a href="${url}" title="${title}">${title || url}</a>`));
|
|
33646
33685
|
};
|
|
33647
33686
|
let sourceAnchor = null;
|
|
@@ -33654,6 +33693,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_3__.Config.prototype.controls.file = {
|
|
|
33654
33693
|
close();
|
|
33655
33694
|
},
|
|
33656
33695
|
upload: (data)=>{
|
|
33696
|
+
restoreSelection();
|
|
33657
33697
|
(editor.o.file?.defaultHandlerSuccess ?? insertLinks).call(editor, data);
|
|
33658
33698
|
},
|
|
33659
33699
|
url: (url, text)=>{
|
|
@@ -39915,6 +39955,16 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.link = {
|
|
|
39915
39955
|
followOnDblClick: false,
|
|
39916
39956
|
processVideoLink: true,
|
|
39917
39957
|
processPastedLink: true,
|
|
39958
|
+
processTypedLink: false,
|
|
39959
|
+
typedLinkTlds: [],
|
|
39960
|
+
typedLinkFileEndings: [
|
|
39961
|
+
'zip',
|
|
39962
|
+
'mov',
|
|
39963
|
+
'md',
|
|
39964
|
+
'py',
|
|
39965
|
+
'sh',
|
|
39966
|
+
'pub'
|
|
39967
|
+
],
|
|
39918
39968
|
deriveUrlFromText: false,
|
|
39919
39969
|
noFollowCheckbox: true,
|
|
39920
39970
|
openInNewTabCheckbox: true,
|
|
@@ -39966,12 +40016,14 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
39966
40016
|
/* unused harmony export link */
|
|
39967
40017
|
/* harmony import */ var _swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(25045);
|
|
39968
40018
|
/* harmony import */ var _swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(31635);
|
|
39969
|
-
/* harmony import */ var
|
|
39970
|
-
/* harmony import */ var
|
|
39971
|
-
/* harmony import */ var
|
|
39972
|
-
/* harmony import */ var
|
|
39973
|
-
/* harmony import */ var
|
|
39974
|
-
/* harmony import */ var
|
|
40019
|
+
/* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(81937);
|
|
40020
|
+
/* harmony import */ var jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(84839);
|
|
40021
|
+
/* harmony import */ var jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(27795);
|
|
40022
|
+
/* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(28077);
|
|
40023
|
+
/* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(65946);
|
|
40024
|
+
/* harmony import */ var jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(91206);
|
|
40025
|
+
/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(65230);
|
|
40026
|
+
/* harmony import */ var _typed_link__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(99763);
|
|
39975
40027
|
/*!
|
|
39976
40028
|
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
39977
40029
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
@@ -39988,9 +40040,11 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
39988
40040
|
|
|
39989
40041
|
|
|
39990
40042
|
|
|
40043
|
+
|
|
40044
|
+
|
|
39991
40045
|
/**
|
|
39992
40046
|
* Process link. Insert, dblclick or remove format
|
|
39993
|
-
*/ class link extends
|
|
40047
|
+
*/ class link extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin {
|
|
39994
40048
|
/** @override */ afterInit(jodit) {
|
|
39995
40049
|
if (jodit.o.link.followOnDblClick) {
|
|
39996
40050
|
jodit.e.on('dblclick.link', this.__onDblClickOnLink);
|
|
@@ -39999,6 +40053,14 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
39999
40053
|
if (jodit.o.link.processPastedLink) {
|
|
40000
40054
|
jodit.e.on('processPaste.link', this.onProcessPasteLink);
|
|
40001
40055
|
}
|
|
40056
|
+
if (jodit.o.link.processTypedLink) {
|
|
40057
|
+
this.__linkAfterEnter = jodit.async.microDebounce(this.__linkTyped);
|
|
40058
|
+
jodit.e.on('input.link', this.__onTypedSpace).on('beforeEnter.link', this.__onBeforeEnter).on('afterEnter.link', this.__onAfterEnter).on('mousedown.link blur.link beforeCommand.link', this.__forgetLink)// Without a namespace it runs ahead of table navigation,
|
|
40059
|
+
// which moves the caret on Tab, and of the backspace plugin
|
|
40060
|
+
.on('keydown', this.__onKeyDown, {
|
|
40061
|
+
top: true
|
|
40062
|
+
});
|
|
40063
|
+
}
|
|
40002
40064
|
jodit.e.on('generateLinkForm.link', this.__generateForm);
|
|
40003
40065
|
jodit.registerCommand('openLinkDialog', {
|
|
40004
40066
|
exec: ()=>{
|
|
@@ -40012,7 +40074,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
40012
40074
|
dialog.setContent(htmlForm);
|
|
40013
40075
|
dialog.open();
|
|
40014
40076
|
jodit.async.requestIdleCallback(()=>{
|
|
40015
|
-
const { url_input } = (0,
|
|
40077
|
+
const { url_input } = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.refs)(htmlForm.container);
|
|
40016
40078
|
url_input?.focus();
|
|
40017
40079
|
});
|
|
40018
40080
|
},
|
|
@@ -40020,10 +40082,10 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
40020
40082
|
});
|
|
40021
40083
|
}
|
|
40022
40084
|
__onDblClickOnLink(e) {
|
|
40023
|
-
if (!
|
|
40085
|
+
if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isTag(e.target, 'a')) {
|
|
40024
40086
|
return;
|
|
40025
40087
|
}
|
|
40026
|
-
const href = (0,
|
|
40088
|
+
const href = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(e.target, 'href');
|
|
40027
40089
|
if (href) {
|
|
40028
40090
|
location.href = href;
|
|
40029
40091
|
e.preventDefault();
|
|
@@ -40031,23 +40093,23 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
40031
40093
|
}
|
|
40032
40094
|
onProcessPasteLink(ignore, html) {
|
|
40033
40095
|
const { jodit } = this;
|
|
40034
|
-
if (!(0,
|
|
40096
|
+
if (!(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.isURL)(html) || !jodit.o.link.processPastedLink) {
|
|
40035
40097
|
return;
|
|
40036
40098
|
}
|
|
40037
40099
|
jodit.e.stopPropagation('processPaste');
|
|
40038
40100
|
if (jodit.o.link.processVideoLink) {
|
|
40039
|
-
const embed = (0,
|
|
40101
|
+
const embed = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.call)(jodit.o.video?.parseUrlToVideoEmbed ?? jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.convertMediaUrlToVideoEmbed, html, {
|
|
40040
40102
|
width: jodit.o.video?.defaultWidth,
|
|
40041
40103
|
height: jodit.o.video?.defaultHeight
|
|
40042
40104
|
});
|
|
40043
40105
|
if (embed !== html) {
|
|
40044
|
-
const media = (0,
|
|
40045
|
-
return (0,
|
|
40106
|
+
const media = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.prepareEmbedCode)(jodit, embed);
|
|
40107
|
+
return (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.isString)(media) ? jodit.createInside.fromHTML(media) : media;
|
|
40046
40108
|
}
|
|
40047
40109
|
}
|
|
40048
40110
|
if (jodit.s.isCollapsed()) {
|
|
40049
40111
|
const a = jodit.createInside.element('a');
|
|
40050
|
-
(0,
|
|
40112
|
+
(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'href', html);
|
|
40051
40113
|
a.textContent = html;
|
|
40052
40114
|
jodit.e.fire('applyLink', jodit, a, null);
|
|
40053
40115
|
return a;
|
|
@@ -40065,16 +40127,16 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
40065
40127
|
const i18n = jodit.i18n.bind(jodit);
|
|
40066
40128
|
const { openInNewTabCheckbox, openInNewTabCheckboxDefaultChecked, noFollowCheckbox, formTemplate, formClassName, modeClassName } = jodit.o.link;
|
|
40067
40129
|
const html = formTemplate(jodit);
|
|
40068
|
-
const form = (0,
|
|
40130
|
+
const form = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.isString)(html) ? jodit.c.fromHTML(html, {
|
|
40069
40131
|
target_checkbox_box: openInNewTabCheckbox,
|
|
40070
40132
|
nofollow_checkbox_box: noFollowCheckbox
|
|
40071
40133
|
}) : html;
|
|
40072
|
-
const htmlForm =
|
|
40073
|
-
const elements = (0,
|
|
40134
|
+
const htmlForm = jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isElement(form) ? form : form.container;
|
|
40135
|
+
const elements = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.refs)(htmlForm);
|
|
40074
40136
|
const { insert, unlink, content_input_box } = elements;
|
|
40075
40137
|
const { target_checkbox, nofollow_checkbox, url_input } = elements;
|
|
40076
40138
|
const currentElement = current;
|
|
40077
|
-
const isImageContent =
|
|
40139
|
+
const isImageContent = jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isImage(currentElement);
|
|
40078
40140
|
let { content_input } = elements;
|
|
40079
40141
|
const { className_input } = elements, { className_select } = elements, { aria_label_input } = elements;
|
|
40080
40142
|
if (!content_input) {
|
|
@@ -40087,12 +40149,12 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
40087
40149
|
htmlForm.classList.add(formClassName);
|
|
40088
40150
|
}
|
|
40089
40151
|
if (isImageContent) {
|
|
40090
|
-
|
|
40152
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.hide(content_input_box);
|
|
40091
40153
|
}
|
|
40092
40154
|
let link;
|
|
40093
|
-
const getSelectionText = ()=>link ? link.innerText : (0,
|
|
40094
|
-
if (current &&
|
|
40095
|
-
link =
|
|
40155
|
+
const getSelectionText = ()=>link ? link.innerText : (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.stripTags)(jodit.s.range.cloneContents(), jodit.ed);
|
|
40156
|
+
if (current && jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.closest(current, 'a', jodit.editor)) {
|
|
40157
|
+
link = jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.closest(current, 'a', jodit.editor);
|
|
40096
40158
|
} else {
|
|
40097
40159
|
link = false;
|
|
40098
40160
|
}
|
|
@@ -40100,22 +40162,22 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
40100
40162
|
content_input.value = getSelectionText();
|
|
40101
40163
|
}
|
|
40102
40164
|
if (aria_label_input) {
|
|
40103
|
-
aria_label_input.value = link ? (0,
|
|
40165
|
+
aria_label_input.value = link ? (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(link, 'aria-label') || '' : '';
|
|
40104
40166
|
}
|
|
40105
40167
|
if (link) {
|
|
40106
|
-
url_input.value = (0,
|
|
40168
|
+
url_input.value = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(link, 'href') || '';
|
|
40107
40169
|
if (modeClassName) {
|
|
40108
40170
|
readClassnames(modeClassName, className_input, link, className_select);
|
|
40109
40171
|
}
|
|
40110
40172
|
if (openInNewTabCheckbox && target_checkbox) {
|
|
40111
|
-
target_checkbox.checked = (0,
|
|
40173
|
+
target_checkbox.checked = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(link, 'target') === '_blank';
|
|
40112
40174
|
}
|
|
40113
40175
|
if (noFollowCheckbox && nofollow_checkbox) {
|
|
40114
|
-
nofollow_checkbox.checked = ((0,
|
|
40176
|
+
nofollow_checkbox.checked = ((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(link, 'rel') || '').split(/\s+/).includes('nofollow');
|
|
40115
40177
|
}
|
|
40116
40178
|
insert.textContent = i18n('Update');
|
|
40117
40179
|
} else {
|
|
40118
|
-
|
|
40180
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.hide(unlink);
|
|
40119
40181
|
if (jodit.o.link.deriveUrlFromText && url_input && !isImageContent && !url_input.value.trim()) {
|
|
40120
40182
|
url_input.value = guessUrlFromText(content_input.value);
|
|
40121
40183
|
}
|
|
@@ -40130,7 +40192,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
40130
40192
|
jodit.s.restore();
|
|
40131
40193
|
jodit.history.snapshot.restore(snapshot);
|
|
40132
40194
|
if (link) {
|
|
40133
|
-
|
|
40195
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.unwrap(link);
|
|
40134
40196
|
}
|
|
40135
40197
|
jodit.synchronizeValues();
|
|
40136
40198
|
close();
|
|
@@ -40151,12 +40213,12 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
40151
40213
|
const textWasChanged = getSelectionText() !== content_input.value.trim();
|
|
40152
40214
|
const ci = jodit.createInside;
|
|
40153
40215
|
let caretAfter = null;
|
|
40154
|
-
if (!link || !
|
|
40216
|
+
if (!link || !jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isOrContains(jodit.editor, link)) {
|
|
40155
40217
|
if (!jodit.s.isCollapsed()) {
|
|
40156
40218
|
const node = jodit.s.current();
|
|
40157
|
-
if (
|
|
40219
|
+
if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isTag(node, 'img')) {
|
|
40158
40220
|
links = [
|
|
40159
|
-
|
|
40221
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.wrap(node, 'a', ci)
|
|
40160
40222
|
];
|
|
40161
40223
|
} else {
|
|
40162
40224
|
links = jodit.s.wrapInTag('a');
|
|
@@ -40176,27 +40238,27 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
40176
40238
|
];
|
|
40177
40239
|
}
|
|
40178
40240
|
links.forEach((a)=>{
|
|
40179
|
-
;(0,
|
|
40241
|
+
;(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'href', url_input.value);
|
|
40180
40242
|
writeClasses(modeClassName, className_input, className_select, a);
|
|
40181
40243
|
if (!isImageContent) {
|
|
40182
40244
|
writeImage(a, content_input, textWasChanged, url_input);
|
|
40183
40245
|
}
|
|
40184
40246
|
if (openInNewTabCheckbox && target_checkbox) {
|
|
40185
|
-
(0,
|
|
40247
|
+
(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'target', target_checkbox.checked ? '_blank' : null);
|
|
40186
40248
|
}
|
|
40187
40249
|
if (noFollowCheckbox && nofollow_checkbox) {
|
|
40188
|
-
const relParts = ((0,
|
|
40250
|
+
const relParts = ((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'rel') || '').split(/\s+/).filter(Boolean);
|
|
40189
40251
|
const hasNofollow = relParts.includes('nofollow');
|
|
40190
40252
|
if (nofollow_checkbox.checked && !hasNofollow) {
|
|
40191
40253
|
relParts.push('nofollow');
|
|
40192
40254
|
} else if (!nofollow_checkbox.checked && hasNofollow) {
|
|
40193
40255
|
relParts.splice(relParts.indexOf('nofollow'), 1);
|
|
40194
40256
|
}
|
|
40195
|
-
;(0,
|
|
40257
|
+
;(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'rel', relParts.length ? relParts.join(' ') : null);
|
|
40196
40258
|
}
|
|
40197
40259
|
if (aria_label_input) {
|
|
40198
40260
|
const ariaLabel = aria_label_input.value.trim();
|
|
40199
|
-
(0,
|
|
40261
|
+
(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'aria-label', ariaLabel || null);
|
|
40200
40262
|
}
|
|
40201
40263
|
jodit.e.fire('applyLink', jodit, a, form);
|
|
40202
40264
|
});
|
|
@@ -40211,7 +40273,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
40211
40273
|
close();
|
|
40212
40274
|
return false;
|
|
40213
40275
|
};
|
|
40214
|
-
if (
|
|
40276
|
+
if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isElement(form)) {
|
|
40215
40277
|
jodit.e.on(form, 'submit', (event)=>{
|
|
40216
40278
|
event.preventDefault();
|
|
40217
40279
|
event.stopImmediatePropagation();
|
|
@@ -40224,11 +40286,96 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
40224
40286
|
return form;
|
|
40225
40287
|
}
|
|
40226
40288
|
/** @override */ beforeDestruct(jodit) {
|
|
40227
|
-
jodit.e.off('generateLinkForm.link', this.__generateForm).off('dblclick.link', this.__onDblClickOnLink).off(jodit.editor, 'click.link', this.__onClickReadOnlyLink).off('processPaste.link', this.onProcessPasteLink);
|
|
40289
|
+
jodit.e.off('generateLinkForm.link', this.__generateForm).off('dblclick.link', this.__onDblClickOnLink).off(jodit.editor, 'click.link', this.__onClickReadOnlyLink).off('processPaste.link', this.onProcessPasteLink).off('input.link', this.__onTypedSpace).off('beforeEnter.link', this.__onBeforeEnter).off('afterEnter.link', this.__onAfterEnter).off('mousedown.link blur.link beforeCommand.link', this.__forgetLink).off('keydown', this.__onKeyDown);
|
|
40290
|
+
}
|
|
40291
|
+
__onTypedSpace(event) {
|
|
40292
|
+
if (event.inputType !== 'insertText' || !event.data || /\S/.test(event.data)) {
|
|
40293
|
+
return;
|
|
40294
|
+
}
|
|
40295
|
+
const { range } = this.j.s;
|
|
40296
|
+
if (range.collapsed) {
|
|
40297
|
+
this.__linkTyped(range.startContainer, range.startOffset - event.data.length);
|
|
40298
|
+
}
|
|
40299
|
+
}
|
|
40300
|
+
__onBeforeEnter() {
|
|
40301
|
+
const { range } = this.j.s;
|
|
40302
|
+
this.__enteredAt = range.collapsed ? [
|
|
40303
|
+
range.startContainer,
|
|
40304
|
+
range.startOffset
|
|
40305
|
+
] : null;
|
|
40306
|
+
}
|
|
40307
|
+
__onAfterEnter() {
|
|
40308
|
+
if (this.__enteredAt) {
|
|
40309
|
+
this.__linkAfterEnter(...this.__enteredAt);
|
|
40310
|
+
this.__enteredAt = null;
|
|
40311
|
+
}
|
|
40312
|
+
}
|
|
40313
|
+
__forgetLink() {
|
|
40314
|
+
this.__justLinked = null;
|
|
40315
|
+
}
|
|
40316
|
+
__onKeyDown(event) {
|
|
40317
|
+
const { jodit } = this;
|
|
40318
|
+
if (jodit.o.readonly) {
|
|
40319
|
+
return;
|
|
40320
|
+
}
|
|
40321
|
+
const link = this.__justLinked;
|
|
40322
|
+
const modified = event.ctrlKey || event.metaKey || event.altKey;
|
|
40323
|
+
if (!MODIFIER_KEYS.has(event.key)) {
|
|
40324
|
+
this.__justLinked = null;
|
|
40325
|
+
}
|
|
40326
|
+
if (event.key === jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.KEY_BACKSPACE && !modified && link?.isConnected) {
|
|
40327
|
+
this.__recordStep();
|
|
40328
|
+
jodit.s.save();
|
|
40329
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.unwrap(link);
|
|
40330
|
+
jodit.s.restore();
|
|
40331
|
+
this.__recordStep();
|
|
40332
|
+
// Or the backspace plugin takes a character too
|
|
40333
|
+
jodit.e.stopPropagation('keydown');
|
|
40334
|
+
return false;
|
|
40335
|
+
}
|
|
40336
|
+
const { range } = jodit.s;
|
|
40337
|
+
if (event.key === jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.KEY_TAB && !modified && range.collapsed) {
|
|
40338
|
+
this.__linkTyped(range.startContainer, range.startOffset);
|
|
40339
|
+
}
|
|
40340
|
+
}
|
|
40341
|
+
/**
|
|
40342
|
+
* Links the address that ends at `end` in a text node, as a step of its
|
|
40343
|
+
* own in the history, so Undo straight after takes the link off and
|
|
40344
|
+
* leaves the text
|
|
40345
|
+
*/ __linkTyped(node, end) {
|
|
40346
|
+
const { jodit } = this;
|
|
40347
|
+
if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isText(node) || !node.isConnected || end < 0 || end > node.length || jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.closest(node, NO_TYPED_LINKS, jodit.editor)) {
|
|
40348
|
+
return;
|
|
40349
|
+
}
|
|
40350
|
+
const found = (0,_typed_link__WEBPACK_IMPORTED_MODULE_9__.findTypedLink)(node.data, end, jodit.o.link.typedLinkTlds, jodit.o.link.typedLinkFileEndings);
|
|
40351
|
+
if (!found) {
|
|
40352
|
+
return;
|
|
40353
|
+
}
|
|
40354
|
+
const [start, stop, href] = found;
|
|
40355
|
+
this.__recordStep();
|
|
40356
|
+
// The text round the caret splits, and WebKit doesn't keep the caret
|
|
40357
|
+
// where it was
|
|
40358
|
+
jodit.s.save();
|
|
40359
|
+
const range = jodit.ed.createRange();
|
|
40360
|
+
range.setStart(node, start);
|
|
40361
|
+
range.setEnd(node, stop);
|
|
40362
|
+
const a = jodit.createInside.element('a');
|
|
40363
|
+
(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'href', href);
|
|
40364
|
+
range.surroundContents(a);
|
|
40365
|
+
jodit.s.restore();
|
|
40366
|
+
jodit.e.fire('applyLink', jodit, a, null);
|
|
40367
|
+
this.__recordStep();
|
|
40368
|
+
this.__justLinked = a;
|
|
40369
|
+
}
|
|
40370
|
+
/**
|
|
40371
|
+
* Reports what's changed and makes it a history step of its own
|
|
40372
|
+
*/ __recordStep() {
|
|
40373
|
+
this.j.setEditorValue();
|
|
40374
|
+
this.j.e.fire('internalChange');
|
|
40228
40375
|
}
|
|
40229
40376
|
__onClickReadOnlyLink(e) {
|
|
40230
40377
|
const { jodit } = this;
|
|
40231
|
-
if (jodit.o.readonly && jodit.o.link.preventReadOnlyNavigation &&
|
|
40378
|
+
if (jodit.o.readonly && jodit.o.link.preventReadOnlyNavigation && jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isTag(e.target, 'a')) {
|
|
40232
40379
|
e.preventDefault();
|
|
40233
40380
|
}
|
|
40234
40381
|
}
|
|
@@ -40238,22 +40385,59 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
40238
40385
|
name: 'link',
|
|
40239
40386
|
group: 'insert'
|
|
40240
40387
|
}
|
|
40241
|
-
])
|
|
40388
|
+
]), /**
|
|
40389
|
+
* Where the caret was when Enter was pressed. Enter splits the line in a
|
|
40390
|
+
* history transaction, so the link waits until it's over
|
|
40391
|
+
*/ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__enteredAt", null), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__linkAfterEnter", ()=>{}), /**
|
|
40392
|
+
* The link just made, which Backspace straight after takes off again, as
|
|
40393
|
+
* in CKEditor 5. Any other key but a modifier, a click or a command
|
|
40394
|
+
* forgets it
|
|
40395
|
+
*/ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__justLinked", null);
|
|
40242
40396
|
}
|
|
40243
40397
|
}
|
|
40244
40398
|
;(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
40245
|
-
|
|
40399
|
+
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
|
|
40246
40400
|
], link.prototype, "__onDblClickOnLink", null);
|
|
40247
40401
|
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
40248
|
-
|
|
40402
|
+
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
|
|
40249
40403
|
], link.prototype, "onProcessPasteLink", null);
|
|
40250
40404
|
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
40251
|
-
|
|
40405
|
+
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
|
|
40252
40406
|
], link.prototype, "__generateForm", null);
|
|
40253
40407
|
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
40254
|
-
|
|
40408
|
+
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
|
|
40409
|
+
], link.prototype, "__onTypedSpace", null);
|
|
40410
|
+
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
40411
|
+
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
|
|
40412
|
+
], link.prototype, "__onBeforeEnter", null);
|
|
40413
|
+
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
40414
|
+
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
|
|
40415
|
+
], link.prototype, "__onAfterEnter", null);
|
|
40416
|
+
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
40417
|
+
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
|
|
40418
|
+
], link.prototype, "__forgetLink", null);
|
|
40419
|
+
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
40420
|
+
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
|
|
40421
|
+
], link.prototype, "__onKeyDown", null);
|
|
40422
|
+
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
40423
|
+
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
|
|
40424
|
+
], link.prototype, "__linkTyped", null);
|
|
40425
|
+
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
40426
|
+
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
|
|
40255
40427
|
], link.prototype, "__onClickReadOnlyLink", null);
|
|
40256
|
-
|
|
40428
|
+
const NO_TYPED_LINKS = new Set([
|
|
40429
|
+
'a',
|
|
40430
|
+
'pre',
|
|
40431
|
+
'code'
|
|
40432
|
+
]);
|
|
40433
|
+
const MODIFIER_KEYS = new Set([
|
|
40434
|
+
'Shift',
|
|
40435
|
+
'Control',
|
|
40436
|
+
'Alt',
|
|
40437
|
+
'Meta',
|
|
40438
|
+
'CapsLock'
|
|
40439
|
+
]);
|
|
40440
|
+
jodit_core_global__WEBPACK_IMPORTED_MODULE_5__.pluginSystem.add('link', link);
|
|
40257
40441
|
/**
|
|
40258
40442
|
* Guess a usable `href` from the selected text for the link dialog.
|
|
40259
40443
|
* Returns an empty string when the text is not a plausible URL/email,
|
|
@@ -40268,7 +40452,7 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_4__.pluginSystem.add('link', link);
|
|
|
40268
40452
|
return value;
|
|
40269
40453
|
}
|
|
40270
40454
|
// email address -> mailto:
|
|
40271
|
-
if (
|
|
40455
|
+
if (_typed_link__WEBPACK_IMPORTED_MODULE_9__.EMAIL.test(value)) {
|
|
40272
40456
|
return `mailto:${value}`;
|
|
40273
40457
|
}
|
|
40274
40458
|
// bare domain like example.com or www.example.com/path -> https://
|
|
@@ -40281,14 +40465,14 @@ function writeClasses(modeClassName, className_input, className_select, a) {
|
|
|
40281
40465
|
if (modeClassName && (className_input ?? className_select)) {
|
|
40282
40466
|
if (modeClassName === 'input') {
|
|
40283
40467
|
if (className_input.value === '' && a.hasAttribute('class')) {
|
|
40284
|
-
(0,
|
|
40468
|
+
(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'class', null);
|
|
40285
40469
|
}
|
|
40286
40470
|
if (className_input.value !== '') {
|
|
40287
|
-
(0,
|
|
40471
|
+
(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'class', className_input.value);
|
|
40288
40472
|
}
|
|
40289
40473
|
} else if (modeClassName === 'select') {
|
|
40290
40474
|
if (a.hasAttribute('class')) {
|
|
40291
|
-
(0,
|
|
40475
|
+
(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'class', null);
|
|
40292
40476
|
}
|
|
40293
40477
|
for(let i = 0; i < className_select.selectedOptions.length; i++){
|
|
40294
40478
|
const className = className_select.selectedOptions.item(i)?.value;
|
|
@@ -40305,7 +40489,7 @@ function readClassnames(modeClassName, className_input, link, className_select)
|
|
|
40305
40489
|
switch(modeClassName){
|
|
40306
40490
|
case 'input':
|
|
40307
40491
|
if (className_input) {
|
|
40308
|
-
className_input.value = (0,
|
|
40492
|
+
className_input.value = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(link, 'class') || '';
|
|
40309
40493
|
}
|
|
40310
40494
|
break;
|
|
40311
40495
|
case 'select':
|
|
@@ -40316,7 +40500,7 @@ function readClassnames(modeClassName, className_input, link, className_select)
|
|
|
40316
40500
|
option.selected = false;
|
|
40317
40501
|
}
|
|
40318
40502
|
}
|
|
40319
|
-
const classNames = (0,
|
|
40503
|
+
const classNames = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(link, 'class') || '';
|
|
40320
40504
|
classNames.split(/\s+/).filter((cn)=>cn.trim().length > 0).forEach((className)=>{
|
|
40321
40505
|
if (className) {
|
|
40322
40506
|
for(let i = 0; i < className_select.options.length; i++){
|
|
@@ -40447,6 +40631,156 @@ const formTemplate = (editor)=>{
|
|
|
40447
40631
|
/* harmony export */ ]);
|
|
40448
40632
|
|
|
40449
40633
|
|
|
40634
|
+
/***/ }),
|
|
40635
|
+
|
|
40636
|
+
/***/ 4441:
|
|
40637
|
+
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
40638
|
+
|
|
40639
|
+
"use strict";
|
|
40640
|
+
/*!
|
|
40641
|
+
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
40642
|
+
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
40643
|
+
* Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
|
|
40644
|
+
*/ /**
|
|
40645
|
+
* @module plugins/link
|
|
40646
|
+
*/ /**
|
|
40647
|
+
* The endings a bare domain links with, besides those `link.typedLinkTlds`
|
|
40648
|
+
* adds: the generic ones of at least 1 in 1,000 of the sites in Tranco's top
|
|
40649
|
+
* million (list GQ38K, https://tranco-list.eu/list/GQ38K), then every
|
|
40650
|
+
* two-letter one in IANA's list (version 2026102900,
|
|
40651
|
+
* https://data.iana.org/TLD/tlds-alpha-by-domain.txt). Together they're the
|
|
40652
|
+
* endings of 96% of those sites
|
|
40653
|
+
* @private
|
|
40654
|
+
*/ const TLDS = new Set(`
|
|
40655
|
+
app biz casino click cloud club com dev edu gov info live net online org pro
|
|
40656
|
+
shop site space store tech top vip xyz
|
|
40657
|
+
ac ad ae af ag ai al am ao aq ar as at au aw ax az ba bb bd be bf bg bh bi
|
|
40658
|
+
bj bm bn bo br bs bt bv bw by bz ca cc cd cf cg ch ci ck cl cm cn co cr cu
|
|
40659
|
+
cv cw cx cy cz de dj dk dm do dz ec ee eg er es et eu fi fj fk fm fo fr ga
|
|
40660
|
+
gb gd ge gf gg gh gi gl gm gn gp gq gr gs gt gu gw gy hk hm hn hr ht hu id
|
|
40661
|
+
ie il im in io iq ir is it je jm jo jp ke kg kh ki km kn kp kr kw ky kz la
|
|
40662
|
+
lb lc li lk lr ls lt lu lv ly ma mc md me mg mh mk ml mm mn mo mp mq mr ms
|
|
40663
|
+
mt mu mv mw mx my mz na nc ne nf ng ni nl no np nr nu nz om pa pe pf pg ph
|
|
40664
|
+
pk pl pm pn pr ps pt pw py qa re ro rs ru rw sa sb sc sd se sg sh si sj sk
|
|
40665
|
+
sl sm sn so sr ss st su sv sx sy sz tc td tf tg th tj tk tl tm tn to tr tt
|
|
40666
|
+
tv tw tz ua ug uk us uy uz va vc ve vg vi vn vu wf ws ye yt za zm zw
|
|
40667
|
+
`.trim().split(/\s+/));
|
|
40668
|
+
|
|
40669
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, [
|
|
40670
|
+
/* harmony export */ "TLDS", 0, /* binding */ TLDS
|
|
40671
|
+
/* harmony export */ ]);
|
|
40672
|
+
|
|
40673
|
+
|
|
40674
|
+
/***/ }),
|
|
40675
|
+
|
|
40676
|
+
/***/ 99763:
|
|
40677
|
+
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
40678
|
+
|
|
40679
|
+
"use strict";
|
|
40680
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
40681
|
+
/* harmony export */ findTypedLink: function() { return /* binding */ findTypedLink; }
|
|
40682
|
+
/* harmony export */ });
|
|
40683
|
+
/* harmony import */ var jodit_core_helpers_checker_is_url__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(91764);
|
|
40684
|
+
/* harmony import */ var _tlds__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4441);
|
|
40685
|
+
/*!
|
|
40686
|
+
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
40687
|
+
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
40688
|
+
* Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
|
|
40689
|
+
*/ /**
|
|
40690
|
+
* @module plugins/link
|
|
40691
|
+
*/
|
|
40692
|
+
|
|
40693
|
+
/**
|
|
40694
|
+
* An email address, for `mailto:`
|
|
40695
|
+
* @private
|
|
40696
|
+
*/ const EMAIL = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
40697
|
+
const OPENING = new Set([
|
|
40698
|
+
'(',
|
|
40699
|
+
'[',
|
|
40700
|
+
'"',
|
|
40701
|
+
"'",
|
|
40702
|
+
'“',
|
|
40703
|
+
'‘',
|
|
40704
|
+
'<'
|
|
40705
|
+
]);
|
|
40706
|
+
const CLOSING = new Set([
|
|
40707
|
+
'.',
|
|
40708
|
+
',',
|
|
40709
|
+
';',
|
|
40710
|
+
':',
|
|
40711
|
+
'!',
|
|
40712
|
+
'?',
|
|
40713
|
+
'"',
|
|
40714
|
+
"'",
|
|
40715
|
+
'”',
|
|
40716
|
+
'’',
|
|
40717
|
+
'>'
|
|
40718
|
+
]);
|
|
40719
|
+
const BRACKETS = {
|
|
40720
|
+
')': '(',
|
|
40721
|
+
']': '['
|
|
40722
|
+
};
|
|
40723
|
+
const LABEL = /^[a-z\d][a-z\d-]{0,62}$/i;
|
|
40724
|
+
/**
|
|
40725
|
+
* The address that ends at `end` in a line of text typed, back to the
|
|
40726
|
+
* whitespace before it, as `[start, end, href]`. Punctuation round it, such as
|
|
40727
|
+
* a sentence's full stop or a bracket the address doesn't open, stays out.
|
|
40728
|
+
* An address counts with a scheme, with `www.`, as an email address, or as a
|
|
40729
|
+
* bare domain that `isBareDomain` accepts, so `Node.js` or `e.g.` don't
|
|
40730
|
+
* @private
|
|
40731
|
+
*/ function findTypedLink(text, end, tlds, fileEndings) {
|
|
40732
|
+
let start = end;
|
|
40733
|
+
while(start > 0 && !/\s/.test(text[start - 1])){
|
|
40734
|
+
start -= 1;
|
|
40735
|
+
}
|
|
40736
|
+
while(start < end && OPENING.has(text[start])){
|
|
40737
|
+
start += 1;
|
|
40738
|
+
}
|
|
40739
|
+
while(end > start){
|
|
40740
|
+
const char = text[end - 1];
|
|
40741
|
+
const opening = BRACKETS[char];
|
|
40742
|
+
if (CLOSING.has(char) || opening && !text.slice(start, end - 1).includes(opening)) {
|
|
40743
|
+
end -= 1;
|
|
40744
|
+
} else {
|
|
40745
|
+
break;
|
|
40746
|
+
}
|
|
40747
|
+
}
|
|
40748
|
+
const href = typedLinkHref(text.slice(start, end), tlds, fileEndings);
|
|
40749
|
+
return href ? [
|
|
40750
|
+
start,
|
|
40751
|
+
end,
|
|
40752
|
+
href
|
|
40753
|
+
] : null;
|
|
40754
|
+
}
|
|
40755
|
+
function typedLinkHref(address, tlds, fileEndings) {
|
|
40756
|
+
const email = address.replace(/^mailto:/i, '');
|
|
40757
|
+
if (EMAIL.test(email)) {
|
|
40758
|
+
return `mailto:${email}`;
|
|
40759
|
+
}
|
|
40760
|
+
if (/^www\.[^\s.]+\.\S+$/i.test(address) || isBareDomain(address, tlds, fileEndings)) {
|
|
40761
|
+
return `https://${address}`;
|
|
40762
|
+
}
|
|
40763
|
+
return /^[a-z][a-z\d+.-]*:\/\//i.test(address) && (0,jodit_core_helpers_checker_is_url__WEBPACK_IMPORTED_MODULE_0__.isURL)(address) ? address : '';
|
|
40764
|
+
}
|
|
40765
|
+
/**
|
|
40766
|
+
* A domain typed without a scheme or `www.`, as `example.com`, `elections.nz`
|
|
40767
|
+
* or `bit.ly/enrol`. Its ending has to be in `TLDS` or `tlds`, typed in lower
|
|
40768
|
+
* case, so `Node.js` and a sentence run on, as in `home.It`, don't count, and
|
|
40769
|
+
* not in `fileEndings`, as in `photos.zip`. The first part has a letter,
|
|
40770
|
+
* which leaves out a time or a numbered step such as `11.am`
|
|
40771
|
+
*/ function isBareDomain(address, tlds, fileEndings) {
|
|
40772
|
+
const cut = address.search(/[/?#]/);
|
|
40773
|
+
const host = cut < 0 ? address : address.slice(0, cut);
|
|
40774
|
+
const labels = host.split('.');
|
|
40775
|
+
const ending = labels[labels.length - 1];
|
|
40776
|
+
return labels.length > 1 && labels.every((label)=>LABEL.test(label) && !label.endsWith('-')) && (_tlds__WEBPACK_IMPORTED_MODULE_1__.TLDS.has(ending) || tlds.includes(ending)) && !fileEndings.includes(ending) && /[a-z]/i.test(labels[0]);
|
|
40777
|
+
}
|
|
40778
|
+
|
|
40779
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, [
|
|
40780
|
+
/* harmony export */ "EMAIL", 0, /* binding */ EMAIL
|
|
40781
|
+
/* harmony export */ ]);
|
|
40782
|
+
|
|
40783
|
+
|
|
40450
40784
|
/***/ }),
|
|
40451
40785
|
|
|
40452
40786
|
/***/ 51730:
|