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.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);
|
|
@@ -39952,6 +39955,16 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.link = {
|
|
|
39952
39955
|
followOnDblClick: false,
|
|
39953
39956
|
processVideoLink: true,
|
|
39954
39957
|
processPastedLink: true,
|
|
39958
|
+
processTypedLink: false,
|
|
39959
|
+
typedLinkTlds: [],
|
|
39960
|
+
typedLinkFileEndings: [
|
|
39961
|
+
'zip',
|
|
39962
|
+
'mov',
|
|
39963
|
+
'md',
|
|
39964
|
+
'py',
|
|
39965
|
+
'sh',
|
|
39966
|
+
'pub'
|
|
39967
|
+
],
|
|
39955
39968
|
deriveUrlFromText: false,
|
|
39956
39969
|
noFollowCheckbox: true,
|
|
39957
39970
|
openInNewTabCheckbox: true,
|
|
@@ -40003,12 +40016,14 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
40003
40016
|
/* unused harmony export link */
|
|
40004
40017
|
/* harmony import */ var _swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(25045);
|
|
40005
40018
|
/* harmony import */ var _swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(31635);
|
|
40006
|
-
/* harmony import */ var
|
|
40007
|
-
/* harmony import */ var
|
|
40008
|
-
/* harmony import */ var
|
|
40009
|
-
/* harmony import */ var
|
|
40010
|
-
/* harmony import */ var
|
|
40011
|
-
/* 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);
|
|
40012
40027
|
/*!
|
|
40013
40028
|
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
40014
40029
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
@@ -40025,9 +40040,11 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
40025
40040
|
|
|
40026
40041
|
|
|
40027
40042
|
|
|
40043
|
+
|
|
40044
|
+
|
|
40028
40045
|
/**
|
|
40029
40046
|
* Process link. Insert, dblclick or remove format
|
|
40030
|
-
*/ class link extends
|
|
40047
|
+
*/ class link extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin {
|
|
40031
40048
|
/** @override */ afterInit(jodit) {
|
|
40032
40049
|
if (jodit.o.link.followOnDblClick) {
|
|
40033
40050
|
jodit.e.on('dblclick.link', this.__onDblClickOnLink);
|
|
@@ -40036,6 +40053,14 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
40036
40053
|
if (jodit.o.link.processPastedLink) {
|
|
40037
40054
|
jodit.e.on('processPaste.link', this.onProcessPasteLink);
|
|
40038
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
|
+
}
|
|
40039
40064
|
jodit.e.on('generateLinkForm.link', this.__generateForm);
|
|
40040
40065
|
jodit.registerCommand('openLinkDialog', {
|
|
40041
40066
|
exec: ()=>{
|
|
@@ -40049,7 +40074,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
40049
40074
|
dialog.setContent(htmlForm);
|
|
40050
40075
|
dialog.open();
|
|
40051
40076
|
jodit.async.requestIdleCallback(()=>{
|
|
40052
|
-
const { url_input } = (0,
|
|
40077
|
+
const { url_input } = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.refs)(htmlForm.container);
|
|
40053
40078
|
url_input?.focus();
|
|
40054
40079
|
});
|
|
40055
40080
|
},
|
|
@@ -40057,10 +40082,10 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
40057
40082
|
});
|
|
40058
40083
|
}
|
|
40059
40084
|
__onDblClickOnLink(e) {
|
|
40060
|
-
if (!
|
|
40085
|
+
if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isTag(e.target, 'a')) {
|
|
40061
40086
|
return;
|
|
40062
40087
|
}
|
|
40063
|
-
const href = (0,
|
|
40088
|
+
const href = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(e.target, 'href');
|
|
40064
40089
|
if (href) {
|
|
40065
40090
|
location.href = href;
|
|
40066
40091
|
e.preventDefault();
|
|
@@ -40068,23 +40093,23 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
40068
40093
|
}
|
|
40069
40094
|
onProcessPasteLink(ignore, html) {
|
|
40070
40095
|
const { jodit } = this;
|
|
40071
|
-
if (!(0,
|
|
40096
|
+
if (!(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.isURL)(html) || !jodit.o.link.processPastedLink) {
|
|
40072
40097
|
return;
|
|
40073
40098
|
}
|
|
40074
40099
|
jodit.e.stopPropagation('processPaste');
|
|
40075
40100
|
if (jodit.o.link.processVideoLink) {
|
|
40076
|
-
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, {
|
|
40077
40102
|
width: jodit.o.video?.defaultWidth,
|
|
40078
40103
|
height: jodit.o.video?.defaultHeight
|
|
40079
40104
|
});
|
|
40080
40105
|
if (embed !== html) {
|
|
40081
|
-
const media = (0,
|
|
40082
|
-
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;
|
|
40083
40108
|
}
|
|
40084
40109
|
}
|
|
40085
40110
|
if (jodit.s.isCollapsed()) {
|
|
40086
40111
|
const a = jodit.createInside.element('a');
|
|
40087
|
-
(0,
|
|
40112
|
+
(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'href', html);
|
|
40088
40113
|
a.textContent = html;
|
|
40089
40114
|
jodit.e.fire('applyLink', jodit, a, null);
|
|
40090
40115
|
return a;
|
|
@@ -40102,16 +40127,16 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
40102
40127
|
const i18n = jodit.i18n.bind(jodit);
|
|
40103
40128
|
const { openInNewTabCheckbox, openInNewTabCheckboxDefaultChecked, noFollowCheckbox, formTemplate, formClassName, modeClassName } = jodit.o.link;
|
|
40104
40129
|
const html = formTemplate(jodit);
|
|
40105
|
-
const form = (0,
|
|
40130
|
+
const form = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.isString)(html) ? jodit.c.fromHTML(html, {
|
|
40106
40131
|
target_checkbox_box: openInNewTabCheckbox,
|
|
40107
40132
|
nofollow_checkbox_box: noFollowCheckbox
|
|
40108
40133
|
}) : html;
|
|
40109
|
-
const htmlForm =
|
|
40110
|
-
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);
|
|
40111
40136
|
const { insert, unlink, content_input_box } = elements;
|
|
40112
40137
|
const { target_checkbox, nofollow_checkbox, url_input } = elements;
|
|
40113
40138
|
const currentElement = current;
|
|
40114
|
-
const isImageContent =
|
|
40139
|
+
const isImageContent = jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isImage(currentElement);
|
|
40115
40140
|
let { content_input } = elements;
|
|
40116
40141
|
const { className_input } = elements, { className_select } = elements, { aria_label_input } = elements;
|
|
40117
40142
|
if (!content_input) {
|
|
@@ -40124,12 +40149,12 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
40124
40149
|
htmlForm.classList.add(formClassName);
|
|
40125
40150
|
}
|
|
40126
40151
|
if (isImageContent) {
|
|
40127
|
-
|
|
40152
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.hide(content_input_box);
|
|
40128
40153
|
}
|
|
40129
40154
|
let link;
|
|
40130
|
-
const getSelectionText = ()=>link ? link.innerText : (0,
|
|
40131
|
-
if (current &&
|
|
40132
|
-
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);
|
|
40133
40158
|
} else {
|
|
40134
40159
|
link = false;
|
|
40135
40160
|
}
|
|
@@ -40137,22 +40162,22 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
40137
40162
|
content_input.value = getSelectionText();
|
|
40138
40163
|
}
|
|
40139
40164
|
if (aria_label_input) {
|
|
40140
|
-
aria_label_input.value = link ? (0,
|
|
40165
|
+
aria_label_input.value = link ? (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(link, 'aria-label') || '' : '';
|
|
40141
40166
|
}
|
|
40142
40167
|
if (link) {
|
|
40143
|
-
url_input.value = (0,
|
|
40168
|
+
url_input.value = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(link, 'href') || '';
|
|
40144
40169
|
if (modeClassName) {
|
|
40145
40170
|
readClassnames(modeClassName, className_input, link, className_select);
|
|
40146
40171
|
}
|
|
40147
40172
|
if (openInNewTabCheckbox && target_checkbox) {
|
|
40148
|
-
target_checkbox.checked = (0,
|
|
40173
|
+
target_checkbox.checked = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(link, 'target') === '_blank';
|
|
40149
40174
|
}
|
|
40150
40175
|
if (noFollowCheckbox && nofollow_checkbox) {
|
|
40151
|
-
nofollow_checkbox.checked = ((0,
|
|
40176
|
+
nofollow_checkbox.checked = ((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(link, 'rel') || '').split(/\s+/).includes('nofollow');
|
|
40152
40177
|
}
|
|
40153
40178
|
insert.textContent = i18n('Update');
|
|
40154
40179
|
} else {
|
|
40155
|
-
|
|
40180
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.hide(unlink);
|
|
40156
40181
|
if (jodit.o.link.deriveUrlFromText && url_input && !isImageContent && !url_input.value.trim()) {
|
|
40157
40182
|
url_input.value = guessUrlFromText(content_input.value);
|
|
40158
40183
|
}
|
|
@@ -40167,7 +40192,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
40167
40192
|
jodit.s.restore();
|
|
40168
40193
|
jodit.history.snapshot.restore(snapshot);
|
|
40169
40194
|
if (link) {
|
|
40170
|
-
|
|
40195
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.unwrap(link);
|
|
40171
40196
|
}
|
|
40172
40197
|
jodit.synchronizeValues();
|
|
40173
40198
|
close();
|
|
@@ -40188,12 +40213,12 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
40188
40213
|
const textWasChanged = getSelectionText() !== content_input.value.trim();
|
|
40189
40214
|
const ci = jodit.createInside;
|
|
40190
40215
|
let caretAfter = null;
|
|
40191
|
-
if (!link || !
|
|
40216
|
+
if (!link || !jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isOrContains(jodit.editor, link)) {
|
|
40192
40217
|
if (!jodit.s.isCollapsed()) {
|
|
40193
40218
|
const node = jodit.s.current();
|
|
40194
|
-
if (
|
|
40219
|
+
if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isTag(node, 'img')) {
|
|
40195
40220
|
links = [
|
|
40196
|
-
|
|
40221
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.wrap(node, 'a', ci)
|
|
40197
40222
|
];
|
|
40198
40223
|
} else {
|
|
40199
40224
|
links = jodit.s.wrapInTag('a');
|
|
@@ -40213,27 +40238,27 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
40213
40238
|
];
|
|
40214
40239
|
}
|
|
40215
40240
|
links.forEach((a)=>{
|
|
40216
|
-
;(0,
|
|
40241
|
+
;(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'href', url_input.value);
|
|
40217
40242
|
writeClasses(modeClassName, className_input, className_select, a);
|
|
40218
40243
|
if (!isImageContent) {
|
|
40219
40244
|
writeImage(a, content_input, textWasChanged, url_input);
|
|
40220
40245
|
}
|
|
40221
40246
|
if (openInNewTabCheckbox && target_checkbox) {
|
|
40222
|
-
(0,
|
|
40247
|
+
(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'target', target_checkbox.checked ? '_blank' : null);
|
|
40223
40248
|
}
|
|
40224
40249
|
if (noFollowCheckbox && nofollow_checkbox) {
|
|
40225
|
-
const relParts = ((0,
|
|
40250
|
+
const relParts = ((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'rel') || '').split(/\s+/).filter(Boolean);
|
|
40226
40251
|
const hasNofollow = relParts.includes('nofollow');
|
|
40227
40252
|
if (nofollow_checkbox.checked && !hasNofollow) {
|
|
40228
40253
|
relParts.push('nofollow');
|
|
40229
40254
|
} else if (!nofollow_checkbox.checked && hasNofollow) {
|
|
40230
40255
|
relParts.splice(relParts.indexOf('nofollow'), 1);
|
|
40231
40256
|
}
|
|
40232
|
-
;(0,
|
|
40257
|
+
;(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'rel', relParts.length ? relParts.join(' ') : null);
|
|
40233
40258
|
}
|
|
40234
40259
|
if (aria_label_input) {
|
|
40235
40260
|
const ariaLabel = aria_label_input.value.trim();
|
|
40236
|
-
(0,
|
|
40261
|
+
(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'aria-label', ariaLabel || null);
|
|
40237
40262
|
}
|
|
40238
40263
|
jodit.e.fire('applyLink', jodit, a, form);
|
|
40239
40264
|
});
|
|
@@ -40248,7 +40273,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
40248
40273
|
close();
|
|
40249
40274
|
return false;
|
|
40250
40275
|
};
|
|
40251
|
-
if (
|
|
40276
|
+
if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isElement(form)) {
|
|
40252
40277
|
jodit.e.on(form, 'submit', (event)=>{
|
|
40253
40278
|
event.preventDefault();
|
|
40254
40279
|
event.stopImmediatePropagation();
|
|
@@ -40261,11 +40286,96 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
40261
40286
|
return form;
|
|
40262
40287
|
}
|
|
40263
40288
|
/** @override */ beforeDestruct(jodit) {
|
|
40264
|
-
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');
|
|
40265
40375
|
}
|
|
40266
40376
|
__onClickReadOnlyLink(e) {
|
|
40267
40377
|
const { jodit } = this;
|
|
40268
|
-
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')) {
|
|
40269
40379
|
e.preventDefault();
|
|
40270
40380
|
}
|
|
40271
40381
|
}
|
|
@@ -40275,22 +40385,59 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
40275
40385
|
name: 'link',
|
|
40276
40386
|
group: 'insert'
|
|
40277
40387
|
}
|
|
40278
|
-
])
|
|
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);
|
|
40279
40396
|
}
|
|
40280
40397
|
}
|
|
40281
40398
|
;(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
40282
|
-
|
|
40399
|
+
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
|
|
40283
40400
|
], link.prototype, "__onDblClickOnLink", null);
|
|
40284
40401
|
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
40285
|
-
|
|
40402
|
+
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
|
|
40286
40403
|
], link.prototype, "onProcessPasteLink", null);
|
|
40287
40404
|
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
40288
|
-
|
|
40405
|
+
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
|
|
40289
40406
|
], link.prototype, "__generateForm", null);
|
|
40290
40407
|
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
40291
|
-
|
|
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
|
|
40292
40427
|
], link.prototype, "__onClickReadOnlyLink", null);
|
|
40293
|
-
|
|
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);
|
|
40294
40441
|
/**
|
|
40295
40442
|
* Guess a usable `href` from the selected text for the link dialog.
|
|
40296
40443
|
* Returns an empty string when the text is not a plausible URL/email,
|
|
@@ -40305,7 +40452,7 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_4__.pluginSystem.add('link', link);
|
|
|
40305
40452
|
return value;
|
|
40306
40453
|
}
|
|
40307
40454
|
// email address -> mailto:
|
|
40308
|
-
if (
|
|
40455
|
+
if (_typed_link__WEBPACK_IMPORTED_MODULE_9__.EMAIL.test(value)) {
|
|
40309
40456
|
return `mailto:${value}`;
|
|
40310
40457
|
}
|
|
40311
40458
|
// bare domain like example.com or www.example.com/path -> https://
|
|
@@ -40318,14 +40465,14 @@ function writeClasses(modeClassName, className_input, className_select, a) {
|
|
|
40318
40465
|
if (modeClassName && (className_input ?? className_select)) {
|
|
40319
40466
|
if (modeClassName === 'input') {
|
|
40320
40467
|
if (className_input.value === '' && a.hasAttribute('class')) {
|
|
40321
|
-
(0,
|
|
40468
|
+
(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'class', null);
|
|
40322
40469
|
}
|
|
40323
40470
|
if (className_input.value !== '') {
|
|
40324
|
-
(0,
|
|
40471
|
+
(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'class', className_input.value);
|
|
40325
40472
|
}
|
|
40326
40473
|
} else if (modeClassName === 'select') {
|
|
40327
40474
|
if (a.hasAttribute('class')) {
|
|
40328
|
-
(0,
|
|
40475
|
+
(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'class', null);
|
|
40329
40476
|
}
|
|
40330
40477
|
for(let i = 0; i < className_select.selectedOptions.length; i++){
|
|
40331
40478
|
const className = className_select.selectedOptions.item(i)?.value;
|
|
@@ -40342,7 +40489,7 @@ function readClassnames(modeClassName, className_input, link, className_select)
|
|
|
40342
40489
|
switch(modeClassName){
|
|
40343
40490
|
case 'input':
|
|
40344
40491
|
if (className_input) {
|
|
40345
|
-
className_input.value = (0,
|
|
40492
|
+
className_input.value = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(link, 'class') || '';
|
|
40346
40493
|
}
|
|
40347
40494
|
break;
|
|
40348
40495
|
case 'select':
|
|
@@ -40353,7 +40500,7 @@ function readClassnames(modeClassName, className_input, link, className_select)
|
|
|
40353
40500
|
option.selected = false;
|
|
40354
40501
|
}
|
|
40355
40502
|
}
|
|
40356
|
-
const classNames = (0,
|
|
40503
|
+
const classNames = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(link, 'class') || '';
|
|
40357
40504
|
classNames.split(/\s+/).filter((cn)=>cn.trim().length > 0).forEach((className)=>{
|
|
40358
40505
|
if (className) {
|
|
40359
40506
|
for(let i = 0; i < className_select.options.length; i++){
|
|
@@ -40484,6 +40631,156 @@ const formTemplate = (editor)=>{
|
|
|
40484
40631
|
/* harmony export */ ]);
|
|
40485
40632
|
|
|
40486
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
|
+
|
|
40487
40784
|
/***/ }),
|
|
40488
40785
|
|
|
40489
40786
|
/***/ 51730:
|