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/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);
|
|
@@ -34014,10 +34017,34 @@ function brBefore(start) {
|
|
|
34014
34017
|
|
|
34015
34018
|
|
|
34016
34019
|
|
|
34020
|
+
/**
|
|
34021
|
+
* Selected text becomes the link's text, as the Link button does, instead
|
|
34022
|
+
* of being replaced by the file's name. Returns false with nothing selected
|
|
34023
|
+
*/ function wrapSelectionInLink(editor, href, title = '') {
|
|
34024
|
+
if (editor.s.isCollapsed()) {
|
|
34025
|
+
return false;
|
|
34026
|
+
}
|
|
34027
|
+
const links = editor.s.wrapInTag('a');
|
|
34028
|
+
if (!links.length) {
|
|
34029
|
+
return false;
|
|
34030
|
+
}
|
|
34031
|
+
links.forEach((link)=>{
|
|
34032
|
+
;(0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_2__.attr)(link, 'href', href);
|
|
34033
|
+
if (title) {
|
|
34034
|
+
(0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_2__.attr)(link, 'title', title);
|
|
34035
|
+
}
|
|
34036
|
+
});
|
|
34037
|
+
editor.s.setCursorAfter(links[links.length - 1]);
|
|
34038
|
+
return true;
|
|
34039
|
+
}
|
|
34017
34040
|
function insertLinks(data) {
|
|
34018
34041
|
data.files?.forEach((file)=>{
|
|
34042
|
+
const href = data.baseurl + file;
|
|
34043
|
+
if (wrapSelectionInLink(this, href)) {
|
|
34044
|
+
return;
|
|
34045
|
+
}
|
|
34019
34046
|
const link = this.createInside.element('a', {
|
|
34020
|
-
href
|
|
34047
|
+
href
|
|
34021
34048
|
});
|
|
34022
34049
|
link.textContent = this.o.uploader.getDisplayName.call(this.uploader, data.baseurl, file);
|
|
34023
34050
|
this.s.insertNode(link);
|
|
@@ -34028,7 +34055,19 @@ jodit_config__WEBPACK_IMPORTED_MODULE_3__.Config.prototype.file = {
|
|
|
34028
34055
|
};
|
|
34029
34056
|
jodit_config__WEBPACK_IMPORTED_MODULE_3__.Config.prototype.controls.file = {
|
|
34030
34057
|
popup: (editor, current, close)=>{
|
|
34058
|
+
// The popup's first field takes the focus, so the selection the
|
|
34059
|
+
// popup was opened for is kept and put back before the link goes in
|
|
34060
|
+
const selected = editor.s.isCollapsed() ? null : editor.s.range;
|
|
34061
|
+
const restoreSelection = ()=>{
|
|
34062
|
+
if (selected) {
|
|
34063
|
+
editor.s.selectRange(selected);
|
|
34064
|
+
}
|
|
34065
|
+
};
|
|
34031
34066
|
const insert = (url, title = '')=>{
|
|
34067
|
+
restoreSelection();
|
|
34068
|
+
if (wrapSelectionInLink(editor, url, title)) {
|
|
34069
|
+
return;
|
|
34070
|
+
}
|
|
34032
34071
|
editor.s.insertNode(editor.createInside.fromHTML(`<a href="${url}" title="${title}">${title || url}</a>`));
|
|
34033
34072
|
};
|
|
34034
34073
|
let sourceAnchor = null;
|
|
@@ -34041,6 +34080,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_3__.Config.prototype.controls.file = {
|
|
|
34041
34080
|
close();
|
|
34042
34081
|
},
|
|
34043
34082
|
upload: (data)=>{
|
|
34083
|
+
restoreSelection();
|
|
34044
34084
|
(editor.o.file?.defaultHandlerSuccess ?? insertLinks).call(editor, data);
|
|
34045
34085
|
},
|
|
34046
34086
|
url: (url, text)=>{
|
|
@@ -40668,6 +40708,16 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.link = {
|
|
|
40668
40708
|
followOnDblClick: false,
|
|
40669
40709
|
processVideoLink: true,
|
|
40670
40710
|
processPastedLink: true,
|
|
40711
|
+
processTypedLink: false,
|
|
40712
|
+
typedLinkTlds: [],
|
|
40713
|
+
typedLinkFileEndings: [
|
|
40714
|
+
'zip',
|
|
40715
|
+
'mov',
|
|
40716
|
+
'md',
|
|
40717
|
+
'py',
|
|
40718
|
+
'sh',
|
|
40719
|
+
'pub'
|
|
40720
|
+
],
|
|
40671
40721
|
deriveUrlFromText: false,
|
|
40672
40722
|
noFollowCheckbox: true,
|
|
40673
40723
|
openInNewTabCheckbox: true,
|
|
@@ -40719,12 +40769,14 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
40719
40769
|
/* unused harmony export link */
|
|
40720
40770
|
/* harmony import */ var _swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(25045);
|
|
40721
40771
|
/* harmony import */ var _swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(31635);
|
|
40722
|
-
/* harmony import */ var
|
|
40723
|
-
/* harmony import */ var
|
|
40724
|
-
/* harmony import */ var
|
|
40725
|
-
/* harmony import */ var
|
|
40726
|
-
/* harmony import */ var
|
|
40727
|
-
/* harmony import */ var
|
|
40772
|
+
/* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(81937);
|
|
40773
|
+
/* harmony import */ var jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(84839);
|
|
40774
|
+
/* harmony import */ var jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(27795);
|
|
40775
|
+
/* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(28077);
|
|
40776
|
+
/* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(65946);
|
|
40777
|
+
/* harmony import */ var jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(91206);
|
|
40778
|
+
/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(65230);
|
|
40779
|
+
/* harmony import */ var _typed_link__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(99763);
|
|
40728
40780
|
/*!
|
|
40729
40781
|
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
40730
40782
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
@@ -40741,9 +40793,11 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
40741
40793
|
|
|
40742
40794
|
|
|
40743
40795
|
|
|
40796
|
+
|
|
40797
|
+
|
|
40744
40798
|
/**
|
|
40745
40799
|
* Process link. Insert, dblclick or remove format
|
|
40746
|
-
*/ class link extends
|
|
40800
|
+
*/ class link extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin {
|
|
40747
40801
|
/** @override */ afterInit(jodit) {
|
|
40748
40802
|
if (jodit.o.link.followOnDblClick) {
|
|
40749
40803
|
jodit.e.on('dblclick.link', this.__onDblClickOnLink);
|
|
@@ -40752,6 +40806,14 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
40752
40806
|
if (jodit.o.link.processPastedLink) {
|
|
40753
40807
|
jodit.e.on('processPaste.link', this.onProcessPasteLink);
|
|
40754
40808
|
}
|
|
40809
|
+
if (jodit.o.link.processTypedLink) {
|
|
40810
|
+
this.__linkAfterEnter = jodit.async.microDebounce(this.__linkTyped);
|
|
40811
|
+
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,
|
|
40812
|
+
// which moves the caret on Tab, and of the backspace plugin
|
|
40813
|
+
.on('keydown', this.__onKeyDown, {
|
|
40814
|
+
top: true
|
|
40815
|
+
});
|
|
40816
|
+
}
|
|
40755
40817
|
jodit.e.on('generateLinkForm.link', this.__generateForm);
|
|
40756
40818
|
jodit.registerCommand('openLinkDialog', {
|
|
40757
40819
|
exec: ()=>{
|
|
@@ -40765,7 +40827,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
40765
40827
|
dialog.setContent(htmlForm);
|
|
40766
40828
|
dialog.open();
|
|
40767
40829
|
jodit.async.requestIdleCallback(()=>{
|
|
40768
|
-
const { url_input } = (0,
|
|
40830
|
+
const { url_input } = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.refs)(htmlForm.container);
|
|
40769
40831
|
url_input?.focus();
|
|
40770
40832
|
});
|
|
40771
40833
|
},
|
|
@@ -40773,10 +40835,10 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
40773
40835
|
});
|
|
40774
40836
|
}
|
|
40775
40837
|
__onDblClickOnLink(e) {
|
|
40776
|
-
if (!
|
|
40838
|
+
if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isTag(e.target, 'a')) {
|
|
40777
40839
|
return;
|
|
40778
40840
|
}
|
|
40779
|
-
const href = (0,
|
|
40841
|
+
const href = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(e.target, 'href');
|
|
40780
40842
|
if (href) {
|
|
40781
40843
|
location.href = href;
|
|
40782
40844
|
e.preventDefault();
|
|
@@ -40784,23 +40846,23 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
40784
40846
|
}
|
|
40785
40847
|
onProcessPasteLink(ignore, html) {
|
|
40786
40848
|
const { jodit } = this;
|
|
40787
|
-
if (!(0,
|
|
40849
|
+
if (!(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.isURL)(html) || !jodit.o.link.processPastedLink) {
|
|
40788
40850
|
return;
|
|
40789
40851
|
}
|
|
40790
40852
|
jodit.e.stopPropagation('processPaste');
|
|
40791
40853
|
if (jodit.o.link.processVideoLink) {
|
|
40792
|
-
const embed = (0,
|
|
40854
|
+
const embed = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.call)(jodit.o.video?.parseUrlToVideoEmbed ?? jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.convertMediaUrlToVideoEmbed, html, {
|
|
40793
40855
|
width: jodit.o.video?.defaultWidth,
|
|
40794
40856
|
height: jodit.o.video?.defaultHeight
|
|
40795
40857
|
});
|
|
40796
40858
|
if (embed !== html) {
|
|
40797
|
-
const media = (0,
|
|
40798
|
-
return (0,
|
|
40859
|
+
const media = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.prepareEmbedCode)(jodit, embed);
|
|
40860
|
+
return (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.isString)(media) ? jodit.createInside.fromHTML(media) : media;
|
|
40799
40861
|
}
|
|
40800
40862
|
}
|
|
40801
40863
|
if (jodit.s.isCollapsed()) {
|
|
40802
40864
|
const a = jodit.createInside.element('a');
|
|
40803
|
-
(0,
|
|
40865
|
+
(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'href', html);
|
|
40804
40866
|
a.textContent = html;
|
|
40805
40867
|
jodit.e.fire('applyLink', jodit, a, null);
|
|
40806
40868
|
return a;
|
|
@@ -40818,16 +40880,16 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
40818
40880
|
const i18n = jodit.i18n.bind(jodit);
|
|
40819
40881
|
const { openInNewTabCheckbox, openInNewTabCheckboxDefaultChecked, noFollowCheckbox, formTemplate, formClassName, modeClassName } = jodit.o.link;
|
|
40820
40882
|
const html = formTemplate(jodit);
|
|
40821
|
-
const form = (0,
|
|
40883
|
+
const form = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.isString)(html) ? jodit.c.fromHTML(html, {
|
|
40822
40884
|
target_checkbox_box: openInNewTabCheckbox,
|
|
40823
40885
|
nofollow_checkbox_box: noFollowCheckbox
|
|
40824
40886
|
}) : html;
|
|
40825
|
-
const htmlForm =
|
|
40826
|
-
const elements = (0,
|
|
40887
|
+
const htmlForm = jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isElement(form) ? form : form.container;
|
|
40888
|
+
const elements = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.refs)(htmlForm);
|
|
40827
40889
|
const { insert, unlink, content_input_box } = elements;
|
|
40828
40890
|
const { target_checkbox, nofollow_checkbox, url_input } = elements;
|
|
40829
40891
|
const currentElement = current;
|
|
40830
|
-
const isImageContent =
|
|
40892
|
+
const isImageContent = jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isImage(currentElement);
|
|
40831
40893
|
let { content_input } = elements;
|
|
40832
40894
|
const { className_input } = elements, { className_select } = elements, { aria_label_input } = elements;
|
|
40833
40895
|
if (!content_input) {
|
|
@@ -40840,12 +40902,12 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
40840
40902
|
htmlForm.classList.add(formClassName);
|
|
40841
40903
|
}
|
|
40842
40904
|
if (isImageContent) {
|
|
40843
|
-
|
|
40905
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.hide(content_input_box);
|
|
40844
40906
|
}
|
|
40845
40907
|
let link;
|
|
40846
|
-
const getSelectionText = ()=>link ? link.innerText : (0,
|
|
40847
|
-
if (current &&
|
|
40848
|
-
link =
|
|
40908
|
+
const getSelectionText = ()=>link ? link.innerText : (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.stripTags)(jodit.s.range.cloneContents(), jodit.ed);
|
|
40909
|
+
if (current && jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.closest(current, 'a', jodit.editor)) {
|
|
40910
|
+
link = jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.closest(current, 'a', jodit.editor);
|
|
40849
40911
|
} else {
|
|
40850
40912
|
link = false;
|
|
40851
40913
|
}
|
|
@@ -40853,22 +40915,22 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
40853
40915
|
content_input.value = getSelectionText();
|
|
40854
40916
|
}
|
|
40855
40917
|
if (aria_label_input) {
|
|
40856
|
-
aria_label_input.value = link ? (0,
|
|
40918
|
+
aria_label_input.value = link ? (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(link, 'aria-label') || '' : '';
|
|
40857
40919
|
}
|
|
40858
40920
|
if (link) {
|
|
40859
|
-
url_input.value = (0,
|
|
40921
|
+
url_input.value = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(link, 'href') || '';
|
|
40860
40922
|
if (modeClassName) {
|
|
40861
40923
|
readClassnames(modeClassName, className_input, link, className_select);
|
|
40862
40924
|
}
|
|
40863
40925
|
if (openInNewTabCheckbox && target_checkbox) {
|
|
40864
|
-
target_checkbox.checked = (0,
|
|
40926
|
+
target_checkbox.checked = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(link, 'target') === '_blank';
|
|
40865
40927
|
}
|
|
40866
40928
|
if (noFollowCheckbox && nofollow_checkbox) {
|
|
40867
|
-
nofollow_checkbox.checked = ((0,
|
|
40929
|
+
nofollow_checkbox.checked = ((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(link, 'rel') || '').split(/\s+/).includes('nofollow');
|
|
40868
40930
|
}
|
|
40869
40931
|
insert.textContent = i18n('Update');
|
|
40870
40932
|
} else {
|
|
40871
|
-
|
|
40933
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.hide(unlink);
|
|
40872
40934
|
if (jodit.o.link.deriveUrlFromText && url_input && !isImageContent && !url_input.value.trim()) {
|
|
40873
40935
|
url_input.value = guessUrlFromText(content_input.value);
|
|
40874
40936
|
}
|
|
@@ -40883,7 +40945,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
40883
40945
|
jodit.s.restore();
|
|
40884
40946
|
jodit.history.snapshot.restore(snapshot);
|
|
40885
40947
|
if (link) {
|
|
40886
|
-
|
|
40948
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.unwrap(link);
|
|
40887
40949
|
}
|
|
40888
40950
|
jodit.synchronizeValues();
|
|
40889
40951
|
close();
|
|
@@ -40904,12 +40966,12 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
40904
40966
|
const textWasChanged = getSelectionText() !== content_input.value.trim();
|
|
40905
40967
|
const ci = jodit.createInside;
|
|
40906
40968
|
let caretAfter = null;
|
|
40907
|
-
if (!link || !
|
|
40969
|
+
if (!link || !jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isOrContains(jodit.editor, link)) {
|
|
40908
40970
|
if (!jodit.s.isCollapsed()) {
|
|
40909
40971
|
const node = jodit.s.current();
|
|
40910
|
-
if (
|
|
40972
|
+
if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isTag(node, 'img')) {
|
|
40911
40973
|
links = [
|
|
40912
|
-
|
|
40974
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.wrap(node, 'a', ci)
|
|
40913
40975
|
];
|
|
40914
40976
|
} else {
|
|
40915
40977
|
links = jodit.s.wrapInTag('a');
|
|
@@ -40929,27 +40991,27 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
40929
40991
|
];
|
|
40930
40992
|
}
|
|
40931
40993
|
links.forEach((a)=>{
|
|
40932
|
-
;(0,
|
|
40994
|
+
;(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'href', url_input.value);
|
|
40933
40995
|
writeClasses(modeClassName, className_input, className_select, a);
|
|
40934
40996
|
if (!isImageContent) {
|
|
40935
40997
|
writeImage(a, content_input, textWasChanged, url_input);
|
|
40936
40998
|
}
|
|
40937
40999
|
if (openInNewTabCheckbox && target_checkbox) {
|
|
40938
|
-
(0,
|
|
41000
|
+
(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'target', target_checkbox.checked ? '_blank' : null);
|
|
40939
41001
|
}
|
|
40940
41002
|
if (noFollowCheckbox && nofollow_checkbox) {
|
|
40941
|
-
const relParts = ((0,
|
|
41003
|
+
const relParts = ((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'rel') || '').split(/\s+/).filter(Boolean);
|
|
40942
41004
|
const hasNofollow = relParts.includes('nofollow');
|
|
40943
41005
|
if (nofollow_checkbox.checked && !hasNofollow) {
|
|
40944
41006
|
relParts.push('nofollow');
|
|
40945
41007
|
} else if (!nofollow_checkbox.checked && hasNofollow) {
|
|
40946
41008
|
relParts.splice(relParts.indexOf('nofollow'), 1);
|
|
40947
41009
|
}
|
|
40948
|
-
;(0,
|
|
41010
|
+
;(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'rel', relParts.length ? relParts.join(' ') : null);
|
|
40949
41011
|
}
|
|
40950
41012
|
if (aria_label_input) {
|
|
40951
41013
|
const ariaLabel = aria_label_input.value.trim();
|
|
40952
|
-
(0,
|
|
41014
|
+
(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'aria-label', ariaLabel || null);
|
|
40953
41015
|
}
|
|
40954
41016
|
jodit.e.fire('applyLink', jodit, a, form);
|
|
40955
41017
|
});
|
|
@@ -40964,7 +41026,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
40964
41026
|
close();
|
|
40965
41027
|
return false;
|
|
40966
41028
|
};
|
|
40967
|
-
if (
|
|
41029
|
+
if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isElement(form)) {
|
|
40968
41030
|
jodit.e.on(form, 'submit', (event)=>{
|
|
40969
41031
|
event.preventDefault();
|
|
40970
41032
|
event.stopImmediatePropagation();
|
|
@@ -40977,11 +41039,96 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
40977
41039
|
return form;
|
|
40978
41040
|
}
|
|
40979
41041
|
/** @override */ beforeDestruct(jodit) {
|
|
40980
|
-
jodit.e.off('generateLinkForm.link', this.__generateForm).off('dblclick.link', this.__onDblClickOnLink).off(jodit.editor, 'click.link', this.__onClickReadOnlyLink).off('processPaste.link', this.onProcessPasteLink);
|
|
41042
|
+
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);
|
|
41043
|
+
}
|
|
41044
|
+
__onTypedSpace(event) {
|
|
41045
|
+
if (event.inputType !== 'insertText' || !event.data || /\S/.test(event.data)) {
|
|
41046
|
+
return;
|
|
41047
|
+
}
|
|
41048
|
+
const { range } = this.j.s;
|
|
41049
|
+
if (range.collapsed) {
|
|
41050
|
+
this.__linkTyped(range.startContainer, range.startOffset - event.data.length);
|
|
41051
|
+
}
|
|
41052
|
+
}
|
|
41053
|
+
__onBeforeEnter() {
|
|
41054
|
+
const { range } = this.j.s;
|
|
41055
|
+
this.__enteredAt = range.collapsed ? [
|
|
41056
|
+
range.startContainer,
|
|
41057
|
+
range.startOffset
|
|
41058
|
+
] : null;
|
|
41059
|
+
}
|
|
41060
|
+
__onAfterEnter() {
|
|
41061
|
+
if (this.__enteredAt) {
|
|
41062
|
+
this.__linkAfterEnter(...this.__enteredAt);
|
|
41063
|
+
this.__enteredAt = null;
|
|
41064
|
+
}
|
|
41065
|
+
}
|
|
41066
|
+
__forgetLink() {
|
|
41067
|
+
this.__justLinked = null;
|
|
41068
|
+
}
|
|
41069
|
+
__onKeyDown(event) {
|
|
41070
|
+
const { jodit } = this;
|
|
41071
|
+
if (jodit.o.readonly) {
|
|
41072
|
+
return;
|
|
41073
|
+
}
|
|
41074
|
+
const link = this.__justLinked;
|
|
41075
|
+
const modified = event.ctrlKey || event.metaKey || event.altKey;
|
|
41076
|
+
if (!MODIFIER_KEYS.has(event.key)) {
|
|
41077
|
+
this.__justLinked = null;
|
|
41078
|
+
}
|
|
41079
|
+
if (event.key === jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.KEY_BACKSPACE && !modified && link?.isConnected) {
|
|
41080
|
+
this.__recordStep();
|
|
41081
|
+
jodit.s.save();
|
|
41082
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.unwrap(link);
|
|
41083
|
+
jodit.s.restore();
|
|
41084
|
+
this.__recordStep();
|
|
41085
|
+
// Or the backspace plugin takes a character too
|
|
41086
|
+
jodit.e.stopPropagation('keydown');
|
|
41087
|
+
return false;
|
|
41088
|
+
}
|
|
41089
|
+
const { range } = jodit.s;
|
|
41090
|
+
if (event.key === jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.KEY_TAB && !modified && range.collapsed) {
|
|
41091
|
+
this.__linkTyped(range.startContainer, range.startOffset);
|
|
41092
|
+
}
|
|
41093
|
+
}
|
|
41094
|
+
/**
|
|
41095
|
+
* Links the address that ends at `end` in a text node, as a step of its
|
|
41096
|
+
* own in the history, so Undo straight after takes the link off and
|
|
41097
|
+
* leaves the text
|
|
41098
|
+
*/ __linkTyped(node, end) {
|
|
41099
|
+
const { jodit } = this;
|
|
41100
|
+
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)) {
|
|
41101
|
+
return;
|
|
41102
|
+
}
|
|
41103
|
+
const found = (0,_typed_link__WEBPACK_IMPORTED_MODULE_9__.findTypedLink)(node.data, end, jodit.o.link.typedLinkTlds, jodit.o.link.typedLinkFileEndings);
|
|
41104
|
+
if (!found) {
|
|
41105
|
+
return;
|
|
41106
|
+
}
|
|
41107
|
+
const [start, stop, href] = found;
|
|
41108
|
+
this.__recordStep();
|
|
41109
|
+
// The text round the caret splits, and WebKit doesn't keep the caret
|
|
41110
|
+
// where it was
|
|
41111
|
+
jodit.s.save();
|
|
41112
|
+
const range = jodit.ed.createRange();
|
|
41113
|
+
range.setStart(node, start);
|
|
41114
|
+
range.setEnd(node, stop);
|
|
41115
|
+
const a = jodit.createInside.element('a');
|
|
41116
|
+
(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'href', href);
|
|
41117
|
+
range.surroundContents(a);
|
|
41118
|
+
jodit.s.restore();
|
|
41119
|
+
jodit.e.fire('applyLink', jodit, a, null);
|
|
41120
|
+
this.__recordStep();
|
|
41121
|
+
this.__justLinked = a;
|
|
41122
|
+
}
|
|
41123
|
+
/**
|
|
41124
|
+
* Reports what's changed and makes it a history step of its own
|
|
41125
|
+
*/ __recordStep() {
|
|
41126
|
+
this.j.setEditorValue();
|
|
41127
|
+
this.j.e.fire('internalChange');
|
|
40981
41128
|
}
|
|
40982
41129
|
__onClickReadOnlyLink(e) {
|
|
40983
41130
|
const { jodit } = this;
|
|
40984
|
-
if (jodit.o.readonly && jodit.o.link.preventReadOnlyNavigation &&
|
|
41131
|
+
if (jodit.o.readonly && jodit.o.link.preventReadOnlyNavigation && jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isTag(e.target, 'a')) {
|
|
40985
41132
|
e.preventDefault();
|
|
40986
41133
|
}
|
|
40987
41134
|
}
|
|
@@ -40991,22 +41138,59 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
40991
41138
|
name: 'link',
|
|
40992
41139
|
group: 'insert'
|
|
40993
41140
|
}
|
|
40994
|
-
])
|
|
41141
|
+
]), /**
|
|
41142
|
+
* Where the caret was when Enter was pressed. Enter splits the line in a
|
|
41143
|
+
* history transaction, so the link waits until it's over
|
|
41144
|
+
*/ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__enteredAt", null), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__linkAfterEnter", ()=>{}), /**
|
|
41145
|
+
* The link just made, which Backspace straight after takes off again, as
|
|
41146
|
+
* in CKEditor 5. Any other key but a modifier, a click or a command
|
|
41147
|
+
* forgets it
|
|
41148
|
+
*/ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__justLinked", null);
|
|
40995
41149
|
}
|
|
40996
41150
|
}
|
|
40997
41151
|
;(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
40998
|
-
|
|
41152
|
+
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
|
|
40999
41153
|
], link.prototype, "__onDblClickOnLink", null);
|
|
41000
41154
|
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
41001
|
-
|
|
41155
|
+
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
|
|
41002
41156
|
], link.prototype, "onProcessPasteLink", null);
|
|
41003
41157
|
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
41004
|
-
|
|
41158
|
+
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
|
|
41005
41159
|
], link.prototype, "__generateForm", null);
|
|
41006
41160
|
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
41007
|
-
|
|
41161
|
+
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
|
|
41162
|
+
], link.prototype, "__onTypedSpace", null);
|
|
41163
|
+
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
41164
|
+
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
|
|
41165
|
+
], link.prototype, "__onBeforeEnter", null);
|
|
41166
|
+
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
41167
|
+
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
|
|
41168
|
+
], link.prototype, "__onAfterEnter", null);
|
|
41169
|
+
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
41170
|
+
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
|
|
41171
|
+
], link.prototype, "__forgetLink", null);
|
|
41172
|
+
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
41173
|
+
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
|
|
41174
|
+
], link.prototype, "__onKeyDown", null);
|
|
41175
|
+
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
41176
|
+
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
|
|
41177
|
+
], link.prototype, "__linkTyped", null);
|
|
41178
|
+
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
41179
|
+
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
|
|
41008
41180
|
], link.prototype, "__onClickReadOnlyLink", null);
|
|
41009
|
-
|
|
41181
|
+
const NO_TYPED_LINKS = new Set([
|
|
41182
|
+
'a',
|
|
41183
|
+
'pre',
|
|
41184
|
+
'code'
|
|
41185
|
+
]);
|
|
41186
|
+
const MODIFIER_KEYS = new Set([
|
|
41187
|
+
'Shift',
|
|
41188
|
+
'Control',
|
|
41189
|
+
'Alt',
|
|
41190
|
+
'Meta',
|
|
41191
|
+
'CapsLock'
|
|
41192
|
+
]);
|
|
41193
|
+
jodit_core_global__WEBPACK_IMPORTED_MODULE_5__.pluginSystem.add('link', link);
|
|
41010
41194
|
/**
|
|
41011
41195
|
* Guess a usable `href` from the selected text for the link dialog.
|
|
41012
41196
|
* Returns an empty string when the text is not a plausible URL/email,
|
|
@@ -41021,7 +41205,7 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_4__.pluginSystem.add('link', link);
|
|
|
41021
41205
|
return value;
|
|
41022
41206
|
}
|
|
41023
41207
|
// email address -> mailto:
|
|
41024
|
-
if (
|
|
41208
|
+
if (_typed_link__WEBPACK_IMPORTED_MODULE_9__.EMAIL.test(value)) {
|
|
41025
41209
|
return `mailto:${value}`;
|
|
41026
41210
|
}
|
|
41027
41211
|
// bare domain like example.com or www.example.com/path -> https://
|
|
@@ -41034,14 +41218,14 @@ function writeClasses(modeClassName, className_input, className_select, a) {
|
|
|
41034
41218
|
if (modeClassName && (className_input ?? className_select)) {
|
|
41035
41219
|
if (modeClassName === 'input') {
|
|
41036
41220
|
if (className_input.value === '' && a.hasAttribute('class')) {
|
|
41037
|
-
(0,
|
|
41221
|
+
(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'class', null);
|
|
41038
41222
|
}
|
|
41039
41223
|
if (className_input.value !== '') {
|
|
41040
|
-
(0,
|
|
41224
|
+
(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'class', className_input.value);
|
|
41041
41225
|
}
|
|
41042
41226
|
} else if (modeClassName === 'select') {
|
|
41043
41227
|
if (a.hasAttribute('class')) {
|
|
41044
|
-
(0,
|
|
41228
|
+
(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'class', null);
|
|
41045
41229
|
}
|
|
41046
41230
|
for(let i = 0; i < className_select.selectedOptions.length; i++){
|
|
41047
41231
|
const className = className_select.selectedOptions.item(i)?.value;
|
|
@@ -41058,7 +41242,7 @@ function readClassnames(modeClassName, className_input, link, className_select)
|
|
|
41058
41242
|
switch(modeClassName){
|
|
41059
41243
|
case 'input':
|
|
41060
41244
|
if (className_input) {
|
|
41061
|
-
className_input.value = (0,
|
|
41245
|
+
className_input.value = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(link, 'class') || '';
|
|
41062
41246
|
}
|
|
41063
41247
|
break;
|
|
41064
41248
|
case 'select':
|
|
@@ -41069,7 +41253,7 @@ function readClassnames(modeClassName, className_input, link, className_select)
|
|
|
41069
41253
|
option.selected = false;
|
|
41070
41254
|
}
|
|
41071
41255
|
}
|
|
41072
|
-
const classNames = (0,
|
|
41256
|
+
const classNames = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(link, 'class') || '';
|
|
41073
41257
|
classNames.split(/\s+/).filter((cn)=>cn.trim().length > 0).forEach((className)=>{
|
|
41074
41258
|
if (className) {
|
|
41075
41259
|
for(let i = 0; i < className_select.options.length; i++){
|
|
@@ -41200,6 +41384,156 @@ const formTemplate = (editor)=>{
|
|
|
41200
41384
|
/* harmony export */ ]);
|
|
41201
41385
|
|
|
41202
41386
|
|
|
41387
|
+
/***/ }),
|
|
41388
|
+
|
|
41389
|
+
/***/ 4441:
|
|
41390
|
+
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
41391
|
+
|
|
41392
|
+
"use strict";
|
|
41393
|
+
/*!
|
|
41394
|
+
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
41395
|
+
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
41396
|
+
* Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
|
|
41397
|
+
*/ /**
|
|
41398
|
+
* @module plugins/link
|
|
41399
|
+
*/ /**
|
|
41400
|
+
* The endings a bare domain links with, besides those `link.typedLinkTlds`
|
|
41401
|
+
* adds: the generic ones of at least 1 in 1,000 of the sites in Tranco's top
|
|
41402
|
+
* million (list GQ38K, https://tranco-list.eu/list/GQ38K), then every
|
|
41403
|
+
* two-letter one in IANA's list (version 2026102900,
|
|
41404
|
+
* https://data.iana.org/TLD/tlds-alpha-by-domain.txt). Together they're the
|
|
41405
|
+
* endings of 96% of those sites
|
|
41406
|
+
* @private
|
|
41407
|
+
*/ const TLDS = new Set(`
|
|
41408
|
+
app biz casino click cloud club com dev edu gov info live net online org pro
|
|
41409
|
+
shop site space store tech top vip xyz
|
|
41410
|
+
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
|
|
41411
|
+
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
|
|
41412
|
+
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
|
|
41413
|
+
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
|
|
41414
|
+
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
|
|
41415
|
+
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
|
|
41416
|
+
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
|
|
41417
|
+
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
|
|
41418
|
+
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
|
|
41419
|
+
tv tw tz ua ug uk us uy uz va vc ve vg vi vn vu wf ws ye yt za zm zw
|
|
41420
|
+
`.trim().split(/\s+/));
|
|
41421
|
+
|
|
41422
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, [
|
|
41423
|
+
/* harmony export */ "TLDS", 0, /* binding */ TLDS
|
|
41424
|
+
/* harmony export */ ]);
|
|
41425
|
+
|
|
41426
|
+
|
|
41427
|
+
/***/ }),
|
|
41428
|
+
|
|
41429
|
+
/***/ 99763:
|
|
41430
|
+
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
41431
|
+
|
|
41432
|
+
"use strict";
|
|
41433
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
41434
|
+
/* harmony export */ findTypedLink: function() { return /* binding */ findTypedLink; }
|
|
41435
|
+
/* harmony export */ });
|
|
41436
|
+
/* harmony import */ var jodit_core_helpers_checker_is_url__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(91764);
|
|
41437
|
+
/* harmony import */ var _tlds__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4441);
|
|
41438
|
+
/*!
|
|
41439
|
+
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
41440
|
+
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
41441
|
+
* Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
|
|
41442
|
+
*/ /**
|
|
41443
|
+
* @module plugins/link
|
|
41444
|
+
*/
|
|
41445
|
+
|
|
41446
|
+
/**
|
|
41447
|
+
* An email address, for `mailto:`
|
|
41448
|
+
* @private
|
|
41449
|
+
*/ const EMAIL = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
41450
|
+
const OPENING = new Set([
|
|
41451
|
+
'(',
|
|
41452
|
+
'[',
|
|
41453
|
+
'"',
|
|
41454
|
+
"'",
|
|
41455
|
+
'“',
|
|
41456
|
+
'‘',
|
|
41457
|
+
'<'
|
|
41458
|
+
]);
|
|
41459
|
+
const CLOSING = new Set([
|
|
41460
|
+
'.',
|
|
41461
|
+
',',
|
|
41462
|
+
';',
|
|
41463
|
+
':',
|
|
41464
|
+
'!',
|
|
41465
|
+
'?',
|
|
41466
|
+
'"',
|
|
41467
|
+
"'",
|
|
41468
|
+
'”',
|
|
41469
|
+
'’',
|
|
41470
|
+
'>'
|
|
41471
|
+
]);
|
|
41472
|
+
const BRACKETS = {
|
|
41473
|
+
')': '(',
|
|
41474
|
+
']': '['
|
|
41475
|
+
};
|
|
41476
|
+
const LABEL = /^[a-z\d][a-z\d-]{0,62}$/i;
|
|
41477
|
+
/**
|
|
41478
|
+
* The address that ends at `end` in a line of text typed, back to the
|
|
41479
|
+
* whitespace before it, as `[start, end, href]`. Punctuation round it, such as
|
|
41480
|
+
* a sentence's full stop or a bracket the address doesn't open, stays out.
|
|
41481
|
+
* An address counts with a scheme, with `www.`, as an email address, or as a
|
|
41482
|
+
* bare domain that `isBareDomain` accepts, so `Node.js` or `e.g.` don't
|
|
41483
|
+
* @private
|
|
41484
|
+
*/ function findTypedLink(text, end, tlds, fileEndings) {
|
|
41485
|
+
let start = end;
|
|
41486
|
+
while(start > 0 && !/\s/.test(text[start - 1])){
|
|
41487
|
+
start -= 1;
|
|
41488
|
+
}
|
|
41489
|
+
while(start < end && OPENING.has(text[start])){
|
|
41490
|
+
start += 1;
|
|
41491
|
+
}
|
|
41492
|
+
while(end > start){
|
|
41493
|
+
const char = text[end - 1];
|
|
41494
|
+
const opening = BRACKETS[char];
|
|
41495
|
+
if (CLOSING.has(char) || opening && !text.slice(start, end - 1).includes(opening)) {
|
|
41496
|
+
end -= 1;
|
|
41497
|
+
} else {
|
|
41498
|
+
break;
|
|
41499
|
+
}
|
|
41500
|
+
}
|
|
41501
|
+
const href = typedLinkHref(text.slice(start, end), tlds, fileEndings);
|
|
41502
|
+
return href ? [
|
|
41503
|
+
start,
|
|
41504
|
+
end,
|
|
41505
|
+
href
|
|
41506
|
+
] : null;
|
|
41507
|
+
}
|
|
41508
|
+
function typedLinkHref(address, tlds, fileEndings) {
|
|
41509
|
+
const email = address.replace(/^mailto:/i, '');
|
|
41510
|
+
if (EMAIL.test(email)) {
|
|
41511
|
+
return `mailto:${email}`;
|
|
41512
|
+
}
|
|
41513
|
+
if (/^www\.[^\s.]+\.\S+$/i.test(address) || isBareDomain(address, tlds, fileEndings)) {
|
|
41514
|
+
return `https://${address}`;
|
|
41515
|
+
}
|
|
41516
|
+
return /^[a-z][a-z\d+.-]*:\/\//i.test(address) && (0,jodit_core_helpers_checker_is_url__WEBPACK_IMPORTED_MODULE_0__.isURL)(address) ? address : '';
|
|
41517
|
+
}
|
|
41518
|
+
/**
|
|
41519
|
+
* A domain typed without a scheme or `www.`, as `example.com`, `elections.nz`
|
|
41520
|
+
* or `bit.ly/enrol`. Its ending has to be in `TLDS` or `tlds`, typed in lower
|
|
41521
|
+
* case, so `Node.js` and a sentence run on, as in `home.It`, don't count, and
|
|
41522
|
+
* not in `fileEndings`, as in `photos.zip`. The first part has a letter,
|
|
41523
|
+
* which leaves out a time or a numbered step such as `11.am`
|
|
41524
|
+
*/ function isBareDomain(address, tlds, fileEndings) {
|
|
41525
|
+
const cut = address.search(/[/?#]/);
|
|
41526
|
+
const host = cut < 0 ? address : address.slice(0, cut);
|
|
41527
|
+
const labels = host.split('.');
|
|
41528
|
+
const ending = labels[labels.length - 1];
|
|
41529
|
+
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]);
|
|
41530
|
+
}
|
|
41531
|
+
|
|
41532
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, [
|
|
41533
|
+
/* harmony export */ "EMAIL", 0, /* binding */ EMAIL
|
|
41534
|
+
/* harmony export */ ]);
|
|
41535
|
+
|
|
41536
|
+
|
|
41203
41537
|
/***/ }),
|
|
41204
41538
|
|
|
41205
41539
|
/***/ 51730:
|