jodit 4.19.5 → 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 +10 -0
- package/es2015/jodit.css +1 -1
- package/es2015/jodit.fat.min.js +19 -6
- package/es2015/jodit.js +355 -55
- package/es2015/jodit.min.js +16 -3
- 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 +16 -3
- package/es2018/jodit.min.js +16 -3
- 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 +17 -4
- package/es2021/jodit.js +352 -55
- package/es2021/jodit.min.js +17 -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 +19 -6
- package/es2021.en/jodit.js +352 -55
- package/es2021.en/jodit.min.js +19 -6
- 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 +371 -61
- 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/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);
|
|
@@ -40705,6 +40708,16 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.link = {
|
|
|
40705
40708
|
followOnDblClick: false,
|
|
40706
40709
|
processVideoLink: true,
|
|
40707
40710
|
processPastedLink: true,
|
|
40711
|
+
processTypedLink: false,
|
|
40712
|
+
typedLinkTlds: [],
|
|
40713
|
+
typedLinkFileEndings: [
|
|
40714
|
+
'zip',
|
|
40715
|
+
'mov',
|
|
40716
|
+
'md',
|
|
40717
|
+
'py',
|
|
40718
|
+
'sh',
|
|
40719
|
+
'pub'
|
|
40720
|
+
],
|
|
40708
40721
|
deriveUrlFromText: false,
|
|
40709
40722
|
noFollowCheckbox: true,
|
|
40710
40723
|
openInNewTabCheckbox: true,
|
|
@@ -40756,12 +40769,14 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
40756
40769
|
/* unused harmony export link */
|
|
40757
40770
|
/* harmony import */ var _swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(25045);
|
|
40758
40771
|
/* harmony import */ var _swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(31635);
|
|
40759
|
-
/* harmony import */ var
|
|
40760
|
-
/* harmony import */ var
|
|
40761
|
-
/* harmony import */ var
|
|
40762
|
-
/* harmony import */ var
|
|
40763
|
-
/* harmony import */ var
|
|
40764
|
-
/* 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);
|
|
40765
40780
|
/*!
|
|
40766
40781
|
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
40767
40782
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
@@ -40778,9 +40793,11 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
40778
40793
|
|
|
40779
40794
|
|
|
40780
40795
|
|
|
40796
|
+
|
|
40797
|
+
|
|
40781
40798
|
/**
|
|
40782
40799
|
* Process link. Insert, dblclick or remove format
|
|
40783
|
-
*/ class link extends
|
|
40800
|
+
*/ class link extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin {
|
|
40784
40801
|
/** @override */ afterInit(jodit) {
|
|
40785
40802
|
if (jodit.o.link.followOnDblClick) {
|
|
40786
40803
|
jodit.e.on('dblclick.link', this.__onDblClickOnLink);
|
|
@@ -40789,6 +40806,14 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
40789
40806
|
if (jodit.o.link.processPastedLink) {
|
|
40790
40807
|
jodit.e.on('processPaste.link', this.onProcessPasteLink);
|
|
40791
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
|
+
}
|
|
40792
40817
|
jodit.e.on('generateLinkForm.link', this.__generateForm);
|
|
40793
40818
|
jodit.registerCommand('openLinkDialog', {
|
|
40794
40819
|
exec: ()=>{
|
|
@@ -40802,7 +40827,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
40802
40827
|
dialog.setContent(htmlForm);
|
|
40803
40828
|
dialog.open();
|
|
40804
40829
|
jodit.async.requestIdleCallback(()=>{
|
|
40805
|
-
const { url_input } = (0,
|
|
40830
|
+
const { url_input } = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.refs)(htmlForm.container);
|
|
40806
40831
|
url_input?.focus();
|
|
40807
40832
|
});
|
|
40808
40833
|
},
|
|
@@ -40810,10 +40835,10 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
40810
40835
|
});
|
|
40811
40836
|
}
|
|
40812
40837
|
__onDblClickOnLink(e) {
|
|
40813
|
-
if (!
|
|
40838
|
+
if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isTag(e.target, 'a')) {
|
|
40814
40839
|
return;
|
|
40815
40840
|
}
|
|
40816
|
-
const href = (0,
|
|
40841
|
+
const href = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(e.target, 'href');
|
|
40817
40842
|
if (href) {
|
|
40818
40843
|
location.href = href;
|
|
40819
40844
|
e.preventDefault();
|
|
@@ -40821,23 +40846,23 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
40821
40846
|
}
|
|
40822
40847
|
onProcessPasteLink(ignore, html) {
|
|
40823
40848
|
const { jodit } = this;
|
|
40824
|
-
if (!(0,
|
|
40849
|
+
if (!(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.isURL)(html) || !jodit.o.link.processPastedLink) {
|
|
40825
40850
|
return;
|
|
40826
40851
|
}
|
|
40827
40852
|
jodit.e.stopPropagation('processPaste');
|
|
40828
40853
|
if (jodit.o.link.processVideoLink) {
|
|
40829
|
-
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, {
|
|
40830
40855
|
width: jodit.o.video?.defaultWidth,
|
|
40831
40856
|
height: jodit.o.video?.defaultHeight
|
|
40832
40857
|
});
|
|
40833
40858
|
if (embed !== html) {
|
|
40834
|
-
const media = (0,
|
|
40835
|
-
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;
|
|
40836
40861
|
}
|
|
40837
40862
|
}
|
|
40838
40863
|
if (jodit.s.isCollapsed()) {
|
|
40839
40864
|
const a = jodit.createInside.element('a');
|
|
40840
|
-
(0,
|
|
40865
|
+
(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'href', html);
|
|
40841
40866
|
a.textContent = html;
|
|
40842
40867
|
jodit.e.fire('applyLink', jodit, a, null);
|
|
40843
40868
|
return a;
|
|
@@ -40855,16 +40880,16 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
40855
40880
|
const i18n = jodit.i18n.bind(jodit);
|
|
40856
40881
|
const { openInNewTabCheckbox, openInNewTabCheckboxDefaultChecked, noFollowCheckbox, formTemplate, formClassName, modeClassName } = jodit.o.link;
|
|
40857
40882
|
const html = formTemplate(jodit);
|
|
40858
|
-
const form = (0,
|
|
40883
|
+
const form = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.isString)(html) ? jodit.c.fromHTML(html, {
|
|
40859
40884
|
target_checkbox_box: openInNewTabCheckbox,
|
|
40860
40885
|
nofollow_checkbox_box: noFollowCheckbox
|
|
40861
40886
|
}) : html;
|
|
40862
|
-
const htmlForm =
|
|
40863
|
-
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);
|
|
40864
40889
|
const { insert, unlink, content_input_box } = elements;
|
|
40865
40890
|
const { target_checkbox, nofollow_checkbox, url_input } = elements;
|
|
40866
40891
|
const currentElement = current;
|
|
40867
|
-
const isImageContent =
|
|
40892
|
+
const isImageContent = jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isImage(currentElement);
|
|
40868
40893
|
let { content_input } = elements;
|
|
40869
40894
|
const { className_input } = elements, { className_select } = elements, { aria_label_input } = elements;
|
|
40870
40895
|
if (!content_input) {
|
|
@@ -40877,12 +40902,12 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
40877
40902
|
htmlForm.classList.add(formClassName);
|
|
40878
40903
|
}
|
|
40879
40904
|
if (isImageContent) {
|
|
40880
|
-
|
|
40905
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.hide(content_input_box);
|
|
40881
40906
|
}
|
|
40882
40907
|
let link;
|
|
40883
|
-
const getSelectionText = ()=>link ? link.innerText : (0,
|
|
40884
|
-
if (current &&
|
|
40885
|
-
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);
|
|
40886
40911
|
} else {
|
|
40887
40912
|
link = false;
|
|
40888
40913
|
}
|
|
@@ -40890,22 +40915,22 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
40890
40915
|
content_input.value = getSelectionText();
|
|
40891
40916
|
}
|
|
40892
40917
|
if (aria_label_input) {
|
|
40893
|
-
aria_label_input.value = link ? (0,
|
|
40918
|
+
aria_label_input.value = link ? (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(link, 'aria-label') || '' : '';
|
|
40894
40919
|
}
|
|
40895
40920
|
if (link) {
|
|
40896
|
-
url_input.value = (0,
|
|
40921
|
+
url_input.value = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(link, 'href') || '';
|
|
40897
40922
|
if (modeClassName) {
|
|
40898
40923
|
readClassnames(modeClassName, className_input, link, className_select);
|
|
40899
40924
|
}
|
|
40900
40925
|
if (openInNewTabCheckbox && target_checkbox) {
|
|
40901
|
-
target_checkbox.checked = (0,
|
|
40926
|
+
target_checkbox.checked = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(link, 'target') === '_blank';
|
|
40902
40927
|
}
|
|
40903
40928
|
if (noFollowCheckbox && nofollow_checkbox) {
|
|
40904
|
-
nofollow_checkbox.checked = ((0,
|
|
40929
|
+
nofollow_checkbox.checked = ((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(link, 'rel') || '').split(/\s+/).includes('nofollow');
|
|
40905
40930
|
}
|
|
40906
40931
|
insert.textContent = i18n('Update');
|
|
40907
40932
|
} else {
|
|
40908
|
-
|
|
40933
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.hide(unlink);
|
|
40909
40934
|
if (jodit.o.link.deriveUrlFromText && url_input && !isImageContent && !url_input.value.trim()) {
|
|
40910
40935
|
url_input.value = guessUrlFromText(content_input.value);
|
|
40911
40936
|
}
|
|
@@ -40920,7 +40945,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
40920
40945
|
jodit.s.restore();
|
|
40921
40946
|
jodit.history.snapshot.restore(snapshot);
|
|
40922
40947
|
if (link) {
|
|
40923
|
-
|
|
40948
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.unwrap(link);
|
|
40924
40949
|
}
|
|
40925
40950
|
jodit.synchronizeValues();
|
|
40926
40951
|
close();
|
|
@@ -40941,12 +40966,12 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
40941
40966
|
const textWasChanged = getSelectionText() !== content_input.value.trim();
|
|
40942
40967
|
const ci = jodit.createInside;
|
|
40943
40968
|
let caretAfter = null;
|
|
40944
|
-
if (!link || !
|
|
40969
|
+
if (!link || !jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isOrContains(jodit.editor, link)) {
|
|
40945
40970
|
if (!jodit.s.isCollapsed()) {
|
|
40946
40971
|
const node = jodit.s.current();
|
|
40947
|
-
if (
|
|
40972
|
+
if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isTag(node, 'img')) {
|
|
40948
40973
|
links = [
|
|
40949
|
-
|
|
40974
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.wrap(node, 'a', ci)
|
|
40950
40975
|
];
|
|
40951
40976
|
} else {
|
|
40952
40977
|
links = jodit.s.wrapInTag('a');
|
|
@@ -40966,27 +40991,27 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
40966
40991
|
];
|
|
40967
40992
|
}
|
|
40968
40993
|
links.forEach((a)=>{
|
|
40969
|
-
;(0,
|
|
40994
|
+
;(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'href', url_input.value);
|
|
40970
40995
|
writeClasses(modeClassName, className_input, className_select, a);
|
|
40971
40996
|
if (!isImageContent) {
|
|
40972
40997
|
writeImage(a, content_input, textWasChanged, url_input);
|
|
40973
40998
|
}
|
|
40974
40999
|
if (openInNewTabCheckbox && target_checkbox) {
|
|
40975
|
-
(0,
|
|
41000
|
+
(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'target', target_checkbox.checked ? '_blank' : null);
|
|
40976
41001
|
}
|
|
40977
41002
|
if (noFollowCheckbox && nofollow_checkbox) {
|
|
40978
|
-
const relParts = ((0,
|
|
41003
|
+
const relParts = ((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'rel') || '').split(/\s+/).filter(Boolean);
|
|
40979
41004
|
const hasNofollow = relParts.includes('nofollow');
|
|
40980
41005
|
if (nofollow_checkbox.checked && !hasNofollow) {
|
|
40981
41006
|
relParts.push('nofollow');
|
|
40982
41007
|
} else if (!nofollow_checkbox.checked && hasNofollow) {
|
|
40983
41008
|
relParts.splice(relParts.indexOf('nofollow'), 1);
|
|
40984
41009
|
}
|
|
40985
|
-
;(0,
|
|
41010
|
+
;(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'rel', relParts.length ? relParts.join(' ') : null);
|
|
40986
41011
|
}
|
|
40987
41012
|
if (aria_label_input) {
|
|
40988
41013
|
const ariaLabel = aria_label_input.value.trim();
|
|
40989
|
-
(0,
|
|
41014
|
+
(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'aria-label', ariaLabel || null);
|
|
40990
41015
|
}
|
|
40991
41016
|
jodit.e.fire('applyLink', jodit, a, form);
|
|
40992
41017
|
});
|
|
@@ -41001,7 +41026,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
41001
41026
|
close();
|
|
41002
41027
|
return false;
|
|
41003
41028
|
};
|
|
41004
|
-
if (
|
|
41029
|
+
if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isElement(form)) {
|
|
41005
41030
|
jodit.e.on(form, 'submit', (event)=>{
|
|
41006
41031
|
event.preventDefault();
|
|
41007
41032
|
event.stopImmediatePropagation();
|
|
@@ -41014,11 +41039,96 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
41014
41039
|
return form;
|
|
41015
41040
|
}
|
|
41016
41041
|
/** @override */ beforeDestruct(jodit) {
|
|
41017
|
-
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');
|
|
41018
41128
|
}
|
|
41019
41129
|
__onClickReadOnlyLink(e) {
|
|
41020
41130
|
const { jodit } = this;
|
|
41021
|
-
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')) {
|
|
41022
41132
|
e.preventDefault();
|
|
41023
41133
|
}
|
|
41024
41134
|
}
|
|
@@ -41028,22 +41138,59 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
41028
41138
|
name: 'link',
|
|
41029
41139
|
group: 'insert'
|
|
41030
41140
|
}
|
|
41031
|
-
])
|
|
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);
|
|
41032
41149
|
}
|
|
41033
41150
|
}
|
|
41034
41151
|
;(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
41035
|
-
|
|
41152
|
+
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
|
|
41036
41153
|
], link.prototype, "__onDblClickOnLink", null);
|
|
41037
41154
|
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
41038
|
-
|
|
41155
|
+
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
|
|
41039
41156
|
], link.prototype, "onProcessPasteLink", null);
|
|
41040
41157
|
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
41041
|
-
|
|
41158
|
+
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
|
|
41042
41159
|
], link.prototype, "__generateForm", null);
|
|
41043
41160
|
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
41044
|
-
|
|
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
|
|
41045
41180
|
], link.prototype, "__onClickReadOnlyLink", null);
|
|
41046
|
-
|
|
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);
|
|
41047
41194
|
/**
|
|
41048
41195
|
* Guess a usable `href` from the selected text for the link dialog.
|
|
41049
41196
|
* Returns an empty string when the text is not a plausible URL/email,
|
|
@@ -41058,7 +41205,7 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_4__.pluginSystem.add('link', link);
|
|
|
41058
41205
|
return value;
|
|
41059
41206
|
}
|
|
41060
41207
|
// email address -> mailto:
|
|
41061
|
-
if (
|
|
41208
|
+
if (_typed_link__WEBPACK_IMPORTED_MODULE_9__.EMAIL.test(value)) {
|
|
41062
41209
|
return `mailto:${value}`;
|
|
41063
41210
|
}
|
|
41064
41211
|
// bare domain like example.com or www.example.com/path -> https://
|
|
@@ -41071,14 +41218,14 @@ function writeClasses(modeClassName, className_input, className_select, a) {
|
|
|
41071
41218
|
if (modeClassName && (className_input ?? className_select)) {
|
|
41072
41219
|
if (modeClassName === 'input') {
|
|
41073
41220
|
if (className_input.value === '' && a.hasAttribute('class')) {
|
|
41074
|
-
(0,
|
|
41221
|
+
(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'class', null);
|
|
41075
41222
|
}
|
|
41076
41223
|
if (className_input.value !== '') {
|
|
41077
|
-
(0,
|
|
41224
|
+
(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'class', className_input.value);
|
|
41078
41225
|
}
|
|
41079
41226
|
} else if (modeClassName === 'select') {
|
|
41080
41227
|
if (a.hasAttribute('class')) {
|
|
41081
|
-
(0,
|
|
41228
|
+
(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'class', null);
|
|
41082
41229
|
}
|
|
41083
41230
|
for(let i = 0; i < className_select.selectedOptions.length; i++){
|
|
41084
41231
|
const className = className_select.selectedOptions.item(i)?.value;
|
|
@@ -41095,7 +41242,7 @@ function readClassnames(modeClassName, className_input, link, className_select)
|
|
|
41095
41242
|
switch(modeClassName){
|
|
41096
41243
|
case 'input':
|
|
41097
41244
|
if (className_input) {
|
|
41098
|
-
className_input.value = (0,
|
|
41245
|
+
className_input.value = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(link, 'class') || '';
|
|
41099
41246
|
}
|
|
41100
41247
|
break;
|
|
41101
41248
|
case 'select':
|
|
@@ -41106,7 +41253,7 @@ function readClassnames(modeClassName, className_input, link, className_select)
|
|
|
41106
41253
|
option.selected = false;
|
|
41107
41254
|
}
|
|
41108
41255
|
}
|
|
41109
|
-
const classNames = (0,
|
|
41256
|
+
const classNames = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(link, 'class') || '';
|
|
41110
41257
|
classNames.split(/\s+/).filter((cn)=>cn.trim().length > 0).forEach((className)=>{
|
|
41111
41258
|
if (className) {
|
|
41112
41259
|
for(let i = 0; i < className_select.options.length; i++){
|
|
@@ -41237,6 +41384,156 @@ const formTemplate = (editor)=>{
|
|
|
41237
41384
|
/* harmony export */ ]);
|
|
41238
41385
|
|
|
41239
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
|
+
|
|
41240
41537
|
/***/ }),
|
|
41241
41538
|
|
|
41242
41539
|
/***/ 51730:
|