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/es2015/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
|
*/
|
|
@@ -1830,7 +1830,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1830
1830
|
* ```
|
|
1831
1831
|
* @packageDocumentation
|
|
1832
1832
|
* @module constants
|
|
1833
|
-
*/ const APP_VERSION = "4.19.
|
|
1833
|
+
*/ const APP_VERSION = "4.19.6";
|
|
1834
1834
|
// prettier-ignore
|
|
1835
1835
|
const ES = "es2015";
|
|
1836
1836
|
const IS_ES_MODERN = true;
|
|
@@ -11285,7 +11285,13 @@ function findCorrectCurrentNode(node, range, rightMode, isCollapsed, checkChild,
|
|
|
11285
11285
|
* When the cursor is positioned in its place, it must be inside the element and not outside its border.
|
|
11286
11286
|
* @private
|
|
11287
11287
|
*/ function moveNodeInsideStart(j, node, start) {
|
|
11288
|
-
|
|
11288
|
+
// A text node of non-breaking spaces trims to nothing, but it's text the
|
|
11289
|
+
// node mustn't move past
|
|
11290
|
+
const isContent = (n)=>{
|
|
11291
|
+
var _n_nodeValue;
|
|
11292
|
+
return !jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.isEmptyTextNode(n) || Boolean((_n_nodeValue = n.nodeValue) === null || _n_nodeValue === void 0 ? void 0 : _n_nodeValue.includes(jodit_core_constants__WEBPACK_IMPORTED_MODULE_0__.NBSP_SPACE));
|
|
11293
|
+
};
|
|
11294
|
+
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);
|
|
11289
11295
|
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))){
|
|
11290
11296
|
if (start || !sibling.firstChild) {
|
|
11291
11297
|
jodit_core_dom_dom__WEBPACK_IMPORTED_MODULE_1__.Dom.append(sibling, node);
|
|
@@ -41040,6 +41046,16 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.link = {
|
|
|
41040
41046
|
followOnDblClick: false,
|
|
41041
41047
|
processVideoLink: true,
|
|
41042
41048
|
processPastedLink: true,
|
|
41049
|
+
processTypedLink: false,
|
|
41050
|
+
typedLinkTlds: [],
|
|
41051
|
+
typedLinkFileEndings: [
|
|
41052
|
+
'zip',
|
|
41053
|
+
'mov',
|
|
41054
|
+
'md',
|
|
41055
|
+
'py',
|
|
41056
|
+
'sh',
|
|
41057
|
+
'pub'
|
|
41058
|
+
],
|
|
41043
41059
|
deriveUrlFromText: false,
|
|
41044
41060
|
noFollowCheckbox: true,
|
|
41045
41061
|
openInNewTabCheckbox: true,
|
|
@@ -41091,12 +41107,14 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
41091
41107
|
/* unused harmony export link */
|
|
41092
41108
|
/* harmony import */ var _swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(25045);
|
|
41093
41109
|
/* harmony import */ var _swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(31635);
|
|
41094
|
-
/* harmony import */ var
|
|
41095
|
-
/* harmony import */ var
|
|
41096
|
-
/* harmony import */ var
|
|
41097
|
-
/* harmony import */ var
|
|
41098
|
-
/* harmony import */ var
|
|
41099
|
-
/* harmony import */ var
|
|
41110
|
+
/* harmony import */ var jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(81937);
|
|
41111
|
+
/* harmony import */ var jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(84839);
|
|
41112
|
+
/* harmony import */ var jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(27795);
|
|
41113
|
+
/* harmony import */ var jodit_core_global__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(28077);
|
|
41114
|
+
/* harmony import */ var jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(65946);
|
|
41115
|
+
/* harmony import */ var jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(91206);
|
|
41116
|
+
/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(65230);
|
|
41117
|
+
/* harmony import */ var _typed_link__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(99763);
|
|
41100
41118
|
/*!
|
|
41101
41119
|
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
41102
41120
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
@@ -41113,9 +41131,11 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
41113
41131
|
|
|
41114
41132
|
|
|
41115
41133
|
|
|
41134
|
+
|
|
41135
|
+
|
|
41116
41136
|
/**
|
|
41117
41137
|
* Process link. Insert, dblclick or remove format
|
|
41118
|
-
*/ class link extends
|
|
41138
|
+
*/ class link extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin {
|
|
41119
41139
|
/** @override */ afterInit(jodit) {
|
|
41120
41140
|
if (jodit.o.link.followOnDblClick) {
|
|
41121
41141
|
jodit.e.on('dblclick.link', this.__onDblClickOnLink);
|
|
@@ -41124,6 +41144,14 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
41124
41144
|
if (jodit.o.link.processPastedLink) {
|
|
41125
41145
|
jodit.e.on('processPaste.link', this.onProcessPasteLink);
|
|
41126
41146
|
}
|
|
41147
|
+
if (jodit.o.link.processTypedLink) {
|
|
41148
|
+
this.__linkAfterEnter = jodit.async.microDebounce(this.__linkTyped);
|
|
41149
|
+
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,
|
|
41150
|
+
// which moves the caret on Tab, and of the backspace plugin
|
|
41151
|
+
.on('keydown', this.__onKeyDown, {
|
|
41152
|
+
top: true
|
|
41153
|
+
});
|
|
41154
|
+
}
|
|
41127
41155
|
jodit.e.on('generateLinkForm.link', this.__generateForm);
|
|
41128
41156
|
jodit.registerCommand('openLinkDialog', {
|
|
41129
41157
|
exec: ()=>{
|
|
@@ -41137,7 +41165,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
41137
41165
|
dialog.setContent(htmlForm);
|
|
41138
41166
|
dialog.open();
|
|
41139
41167
|
jodit.async.requestIdleCallback(()=>{
|
|
41140
|
-
const { url_input } = (0,
|
|
41168
|
+
const { url_input } = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.refs)(htmlForm.container);
|
|
41141
41169
|
url_input === null || url_input === void 0 ? void 0 : url_input.focus();
|
|
41142
41170
|
});
|
|
41143
41171
|
},
|
|
@@ -41145,10 +41173,10 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
41145
41173
|
});
|
|
41146
41174
|
}
|
|
41147
41175
|
__onDblClickOnLink(e) {
|
|
41148
|
-
if (!
|
|
41176
|
+
if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isTag(e.target, 'a')) {
|
|
41149
41177
|
return;
|
|
41150
41178
|
}
|
|
41151
|
-
const href = (0,
|
|
41179
|
+
const href = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(e.target, 'href');
|
|
41152
41180
|
if (href) {
|
|
41153
41181
|
location.href = href;
|
|
41154
41182
|
e.preventDefault();
|
|
@@ -41156,25 +41184,25 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
41156
41184
|
}
|
|
41157
41185
|
onProcessPasteLink(ignore, html) {
|
|
41158
41186
|
const { jodit } = this;
|
|
41159
|
-
if (!(0,
|
|
41187
|
+
if (!(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.isURL)(html) || !jodit.o.link.processPastedLink) {
|
|
41160
41188
|
return;
|
|
41161
41189
|
}
|
|
41162
41190
|
jodit.e.stopPropagation('processPaste');
|
|
41163
41191
|
if (jodit.o.link.processVideoLink) {
|
|
41164
41192
|
var _ref;
|
|
41165
41193
|
var _jodit_o_video, _jodit_o_video1, _jodit_o_video2;
|
|
41166
|
-
const embed = (0,
|
|
41194
|
+
const embed = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.call)((_ref = (_jodit_o_video = jodit.o.video) === null || _jodit_o_video === void 0 ? void 0 : _jodit_o_video.parseUrlToVideoEmbed) !== null && _ref !== void 0 ? _ref : jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.convertMediaUrlToVideoEmbed, html, {
|
|
41167
41195
|
width: (_jodit_o_video1 = jodit.o.video) === null || _jodit_o_video1 === void 0 ? void 0 : _jodit_o_video1.defaultWidth,
|
|
41168
41196
|
height: (_jodit_o_video2 = jodit.o.video) === null || _jodit_o_video2 === void 0 ? void 0 : _jodit_o_video2.defaultHeight
|
|
41169
41197
|
});
|
|
41170
41198
|
if (embed !== html) {
|
|
41171
|
-
const media = (0,
|
|
41172
|
-
return (0,
|
|
41199
|
+
const media = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.prepareEmbedCode)(jodit, embed);
|
|
41200
|
+
return (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.isString)(media) ? jodit.createInside.fromHTML(media) : media;
|
|
41173
41201
|
}
|
|
41174
41202
|
}
|
|
41175
41203
|
if (jodit.s.isCollapsed()) {
|
|
41176
41204
|
const a = jodit.createInside.element('a');
|
|
41177
|
-
(0,
|
|
41205
|
+
(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'href', html);
|
|
41178
41206
|
a.textContent = html;
|
|
41179
41207
|
jodit.e.fire('applyLink', jodit, a, null);
|
|
41180
41208
|
return a;
|
|
@@ -41192,16 +41220,16 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
41192
41220
|
const i18n = jodit.i18n.bind(jodit);
|
|
41193
41221
|
const { openInNewTabCheckbox, openInNewTabCheckboxDefaultChecked, noFollowCheckbox, formTemplate, formClassName, modeClassName } = jodit.o.link;
|
|
41194
41222
|
const html = formTemplate(jodit);
|
|
41195
|
-
const form = (0,
|
|
41223
|
+
const form = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.isString)(html) ? jodit.c.fromHTML(html, {
|
|
41196
41224
|
target_checkbox_box: openInNewTabCheckbox,
|
|
41197
41225
|
nofollow_checkbox_box: noFollowCheckbox
|
|
41198
41226
|
}) : html;
|
|
41199
|
-
const htmlForm =
|
|
41200
|
-
const elements = (0,
|
|
41227
|
+
const htmlForm = jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isElement(form) ? form : form.container;
|
|
41228
|
+
const elements = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.refs)(htmlForm);
|
|
41201
41229
|
const { insert, unlink, content_input_box } = elements;
|
|
41202
41230
|
const { target_checkbox, nofollow_checkbox, url_input } = elements;
|
|
41203
41231
|
const currentElement = current;
|
|
41204
|
-
const isImageContent =
|
|
41232
|
+
const isImageContent = jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isImage(currentElement);
|
|
41205
41233
|
let { content_input } = elements;
|
|
41206
41234
|
const { className_input } = elements, { className_select } = elements, { aria_label_input } = elements;
|
|
41207
41235
|
if (!content_input) {
|
|
@@ -41214,12 +41242,12 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
41214
41242
|
htmlForm.classList.add(formClassName);
|
|
41215
41243
|
}
|
|
41216
41244
|
if (isImageContent) {
|
|
41217
|
-
|
|
41245
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.hide(content_input_box);
|
|
41218
41246
|
}
|
|
41219
41247
|
let link;
|
|
41220
|
-
const getSelectionText = ()=>link ? link.innerText : (0,
|
|
41221
|
-
if (current &&
|
|
41222
|
-
link =
|
|
41248
|
+
const getSelectionText = ()=>link ? link.innerText : (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.stripTags)(jodit.s.range.cloneContents(), jodit.ed);
|
|
41249
|
+
if (current && jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.closest(current, 'a', jodit.editor)) {
|
|
41250
|
+
link = jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.closest(current, 'a', jodit.editor);
|
|
41223
41251
|
} else {
|
|
41224
41252
|
link = false;
|
|
41225
41253
|
}
|
|
@@ -41227,22 +41255,22 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
41227
41255
|
content_input.value = getSelectionText();
|
|
41228
41256
|
}
|
|
41229
41257
|
if (aria_label_input) {
|
|
41230
|
-
aria_label_input.value = link ? (0,
|
|
41258
|
+
aria_label_input.value = link ? (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(link, 'aria-label') || '' : '';
|
|
41231
41259
|
}
|
|
41232
41260
|
if (link) {
|
|
41233
|
-
url_input.value = (0,
|
|
41261
|
+
url_input.value = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(link, 'href') || '';
|
|
41234
41262
|
if (modeClassName) {
|
|
41235
41263
|
readClassnames(modeClassName, className_input, link, className_select);
|
|
41236
41264
|
}
|
|
41237
41265
|
if (openInNewTabCheckbox && target_checkbox) {
|
|
41238
|
-
target_checkbox.checked = (0,
|
|
41266
|
+
target_checkbox.checked = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(link, 'target') === '_blank';
|
|
41239
41267
|
}
|
|
41240
41268
|
if (noFollowCheckbox && nofollow_checkbox) {
|
|
41241
|
-
nofollow_checkbox.checked = ((0,
|
|
41269
|
+
nofollow_checkbox.checked = ((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(link, 'rel') || '').split(/\s+/).includes('nofollow');
|
|
41242
41270
|
}
|
|
41243
41271
|
insert.textContent = i18n('Update');
|
|
41244
41272
|
} else {
|
|
41245
|
-
|
|
41273
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.hide(unlink);
|
|
41246
41274
|
if (jodit.o.link.deriveUrlFromText && url_input && !isImageContent && !url_input.value.trim()) {
|
|
41247
41275
|
url_input.value = guessUrlFromText(content_input.value);
|
|
41248
41276
|
}
|
|
@@ -41257,7 +41285,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
41257
41285
|
jodit.s.restore();
|
|
41258
41286
|
jodit.history.snapshot.restore(snapshot);
|
|
41259
41287
|
if (link) {
|
|
41260
|
-
|
|
41288
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.unwrap(link);
|
|
41261
41289
|
}
|
|
41262
41290
|
jodit.synchronizeValues();
|
|
41263
41291
|
close();
|
|
@@ -41278,12 +41306,12 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
41278
41306
|
const textWasChanged = getSelectionText() !== content_input.value.trim();
|
|
41279
41307
|
const ci = jodit.createInside;
|
|
41280
41308
|
let caretAfter = null;
|
|
41281
|
-
if (!link || !
|
|
41309
|
+
if (!link || !jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isOrContains(jodit.editor, link)) {
|
|
41282
41310
|
if (!jodit.s.isCollapsed()) {
|
|
41283
41311
|
const node = jodit.s.current();
|
|
41284
|
-
if (
|
|
41312
|
+
if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isTag(node, 'img')) {
|
|
41285
41313
|
links = [
|
|
41286
|
-
|
|
41314
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.wrap(node, 'a', ci)
|
|
41287
41315
|
];
|
|
41288
41316
|
} else {
|
|
41289
41317
|
links = jodit.s.wrapInTag('a');
|
|
@@ -41303,27 +41331,27 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
41303
41331
|
];
|
|
41304
41332
|
}
|
|
41305
41333
|
links.forEach((a)=>{
|
|
41306
|
-
;(0,
|
|
41334
|
+
;(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'href', url_input.value);
|
|
41307
41335
|
writeClasses(modeClassName, className_input, className_select, a);
|
|
41308
41336
|
if (!isImageContent) {
|
|
41309
41337
|
writeImage(a, content_input, textWasChanged, url_input);
|
|
41310
41338
|
}
|
|
41311
41339
|
if (openInNewTabCheckbox && target_checkbox) {
|
|
41312
|
-
(0,
|
|
41340
|
+
(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'target', target_checkbox.checked ? '_blank' : null);
|
|
41313
41341
|
}
|
|
41314
41342
|
if (noFollowCheckbox && nofollow_checkbox) {
|
|
41315
|
-
const relParts = ((0,
|
|
41343
|
+
const relParts = ((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'rel') || '').split(/\s+/).filter(Boolean);
|
|
41316
41344
|
const hasNofollow = relParts.includes('nofollow');
|
|
41317
41345
|
if (nofollow_checkbox.checked && !hasNofollow) {
|
|
41318
41346
|
relParts.push('nofollow');
|
|
41319
41347
|
} else if (!nofollow_checkbox.checked && hasNofollow) {
|
|
41320
41348
|
relParts.splice(relParts.indexOf('nofollow'), 1);
|
|
41321
41349
|
}
|
|
41322
|
-
;(0,
|
|
41350
|
+
;(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'rel', relParts.length ? relParts.join(' ') : null);
|
|
41323
41351
|
}
|
|
41324
41352
|
if (aria_label_input) {
|
|
41325
41353
|
const ariaLabel = aria_label_input.value.trim();
|
|
41326
|
-
(0,
|
|
41354
|
+
(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'aria-label', ariaLabel || null);
|
|
41327
41355
|
}
|
|
41328
41356
|
jodit.e.fire('applyLink', jodit, a, form);
|
|
41329
41357
|
});
|
|
@@ -41338,7 +41366,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
41338
41366
|
close();
|
|
41339
41367
|
return false;
|
|
41340
41368
|
};
|
|
41341
|
-
if (
|
|
41369
|
+
if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isElement(form)) {
|
|
41342
41370
|
jodit.e.on(form, 'submit', (event)=>{
|
|
41343
41371
|
event.preventDefault();
|
|
41344
41372
|
event.stopImmediatePropagation();
|
|
@@ -41351,11 +41379,96 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
41351
41379
|
return form;
|
|
41352
41380
|
}
|
|
41353
41381
|
/** @override */ beforeDestruct(jodit) {
|
|
41354
|
-
jodit.e.off('generateLinkForm.link', this.__generateForm).off('dblclick.link', this.__onDblClickOnLink).off(jodit.editor, 'click.link', this.__onClickReadOnlyLink).off('processPaste.link', this.onProcessPasteLink);
|
|
41382
|
+
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);
|
|
41383
|
+
}
|
|
41384
|
+
__onTypedSpace(event) {
|
|
41385
|
+
if (event.inputType !== 'insertText' || !event.data || /\S/.test(event.data)) {
|
|
41386
|
+
return;
|
|
41387
|
+
}
|
|
41388
|
+
const { range } = this.j.s;
|
|
41389
|
+
if (range.collapsed) {
|
|
41390
|
+
this.__linkTyped(range.startContainer, range.startOffset - event.data.length);
|
|
41391
|
+
}
|
|
41392
|
+
}
|
|
41393
|
+
__onBeforeEnter() {
|
|
41394
|
+
const { range } = this.j.s;
|
|
41395
|
+
this.__enteredAt = range.collapsed ? [
|
|
41396
|
+
range.startContainer,
|
|
41397
|
+
range.startOffset
|
|
41398
|
+
] : null;
|
|
41399
|
+
}
|
|
41400
|
+
__onAfterEnter() {
|
|
41401
|
+
if (this.__enteredAt) {
|
|
41402
|
+
this.__linkAfterEnter(...this.__enteredAt);
|
|
41403
|
+
this.__enteredAt = null;
|
|
41404
|
+
}
|
|
41405
|
+
}
|
|
41406
|
+
__forgetLink() {
|
|
41407
|
+
this.__justLinked = null;
|
|
41408
|
+
}
|
|
41409
|
+
__onKeyDown(event) {
|
|
41410
|
+
const { jodit } = this;
|
|
41411
|
+
if (jodit.o.readonly) {
|
|
41412
|
+
return;
|
|
41413
|
+
}
|
|
41414
|
+
const link = this.__justLinked;
|
|
41415
|
+
const modified = event.ctrlKey || event.metaKey || event.altKey;
|
|
41416
|
+
if (!MODIFIER_KEYS.has(event.key)) {
|
|
41417
|
+
this.__justLinked = null;
|
|
41418
|
+
}
|
|
41419
|
+
if (event.key === jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.KEY_BACKSPACE && !modified && (link === null || link === void 0 ? void 0 : link.isConnected)) {
|
|
41420
|
+
this.__recordStep();
|
|
41421
|
+
jodit.s.save();
|
|
41422
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.unwrap(link);
|
|
41423
|
+
jodit.s.restore();
|
|
41424
|
+
this.__recordStep();
|
|
41425
|
+
// Or the backspace plugin takes a character too
|
|
41426
|
+
jodit.e.stopPropagation('keydown');
|
|
41427
|
+
return false;
|
|
41428
|
+
}
|
|
41429
|
+
const { range } = jodit.s;
|
|
41430
|
+
if (event.key === jodit_core_constants__WEBPACK_IMPORTED_MODULE_2__.KEY_TAB && !modified && range.collapsed) {
|
|
41431
|
+
this.__linkTyped(range.startContainer, range.startOffset);
|
|
41432
|
+
}
|
|
41433
|
+
}
|
|
41434
|
+
/**
|
|
41435
|
+
* Links the address that ends at `end` in a text node, as a step of its
|
|
41436
|
+
* own in the history, so Undo straight after takes the link off and
|
|
41437
|
+
* leaves the text
|
|
41438
|
+
*/ __linkTyped(node, end) {
|
|
41439
|
+
const { jodit } = this;
|
|
41440
|
+
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)) {
|
|
41441
|
+
return;
|
|
41442
|
+
}
|
|
41443
|
+
const found = (0,_typed_link__WEBPACK_IMPORTED_MODULE_9__.findTypedLink)(node.data, end, jodit.o.link.typedLinkTlds, jodit.o.link.typedLinkFileEndings);
|
|
41444
|
+
if (!found) {
|
|
41445
|
+
return;
|
|
41446
|
+
}
|
|
41447
|
+
const [start, stop, href] = found;
|
|
41448
|
+
this.__recordStep();
|
|
41449
|
+
// The text round the caret splits, and WebKit doesn't keep the caret
|
|
41450
|
+
// where it was
|
|
41451
|
+
jodit.s.save();
|
|
41452
|
+
const range = jodit.ed.createRange();
|
|
41453
|
+
range.setStart(node, start);
|
|
41454
|
+
range.setEnd(node, stop);
|
|
41455
|
+
const a = jodit.createInside.element('a');
|
|
41456
|
+
(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'href', href);
|
|
41457
|
+
range.surroundContents(a);
|
|
41458
|
+
jodit.s.restore();
|
|
41459
|
+
jodit.e.fire('applyLink', jodit, a, null);
|
|
41460
|
+
this.__recordStep();
|
|
41461
|
+
this.__justLinked = a;
|
|
41462
|
+
}
|
|
41463
|
+
/**
|
|
41464
|
+
* Reports what's changed and makes it a history step of its own
|
|
41465
|
+
*/ __recordStep() {
|
|
41466
|
+
this.j.setEditorValue();
|
|
41467
|
+
this.j.e.fire('internalChange');
|
|
41355
41468
|
}
|
|
41356
41469
|
__onClickReadOnlyLink(e) {
|
|
41357
41470
|
const { jodit } = this;
|
|
41358
|
-
if (jodit.o.readonly && jodit.o.link.preventReadOnlyNavigation &&
|
|
41471
|
+
if (jodit.o.readonly && jodit.o.link.preventReadOnlyNavigation && jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isTag(e.target, 'a')) {
|
|
41359
41472
|
e.preventDefault();
|
|
41360
41473
|
}
|
|
41361
41474
|
}
|
|
@@ -41365,22 +41478,59 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
41365
41478
|
name: 'link',
|
|
41366
41479
|
group: 'insert'
|
|
41367
41480
|
}
|
|
41368
|
-
])
|
|
41481
|
+
]), /**
|
|
41482
|
+
* Where the caret was when Enter was pressed. Enter splits the line in a
|
|
41483
|
+
* history transaction, so the link waits until it's over
|
|
41484
|
+
*/ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__enteredAt", null), (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__linkAfterEnter", ()=>{}), /**
|
|
41485
|
+
* The link just made, which Backspace straight after takes off again, as
|
|
41486
|
+
* in CKEditor 5. Any other key but a modifier, a click or a command
|
|
41487
|
+
* forgets it
|
|
41488
|
+
*/ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "__justLinked", null);
|
|
41369
41489
|
}
|
|
41370
41490
|
}
|
|
41371
41491
|
;(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
41372
|
-
|
|
41492
|
+
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
|
|
41373
41493
|
], link.prototype, "__onDblClickOnLink", null);
|
|
41374
41494
|
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
41375
|
-
|
|
41495
|
+
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
|
|
41376
41496
|
], link.prototype, "onProcessPasteLink", null);
|
|
41377
41497
|
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
41378
|
-
|
|
41498
|
+
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
|
|
41379
41499
|
], link.prototype, "__generateForm", null);
|
|
41380
41500
|
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
41381
|
-
|
|
41501
|
+
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
|
|
41502
|
+
], link.prototype, "__onTypedSpace", null);
|
|
41503
|
+
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
41504
|
+
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
|
|
41505
|
+
], link.prototype, "__onBeforeEnter", null);
|
|
41506
|
+
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
41507
|
+
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
|
|
41508
|
+
], link.prototype, "__onAfterEnter", null);
|
|
41509
|
+
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
41510
|
+
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
|
|
41511
|
+
], link.prototype, "__forgetLink", null);
|
|
41512
|
+
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
41513
|
+
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
|
|
41514
|
+
], link.prototype, "__onKeyDown", null);
|
|
41515
|
+
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
41516
|
+
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
|
|
41517
|
+
], link.prototype, "__linkTyped", null);
|
|
41518
|
+
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
41519
|
+
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
|
|
41382
41520
|
], link.prototype, "__onClickReadOnlyLink", null);
|
|
41383
|
-
|
|
41521
|
+
const NO_TYPED_LINKS = new Set([
|
|
41522
|
+
'a',
|
|
41523
|
+
'pre',
|
|
41524
|
+
'code'
|
|
41525
|
+
]);
|
|
41526
|
+
const MODIFIER_KEYS = new Set([
|
|
41527
|
+
'Shift',
|
|
41528
|
+
'Control',
|
|
41529
|
+
'Alt',
|
|
41530
|
+
'Meta',
|
|
41531
|
+
'CapsLock'
|
|
41532
|
+
]);
|
|
41533
|
+
jodit_core_global__WEBPACK_IMPORTED_MODULE_5__.pluginSystem.add('link', link);
|
|
41384
41534
|
/**
|
|
41385
41535
|
* Guess a usable `href` from the selected text for the link dialog.
|
|
41386
41536
|
* Returns an empty string when the text is not a plausible URL/email,
|
|
@@ -41395,7 +41545,7 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_4__.pluginSystem.add('link', link);
|
|
|
41395
41545
|
return value;
|
|
41396
41546
|
}
|
|
41397
41547
|
// email address -> mailto:
|
|
41398
|
-
if (
|
|
41548
|
+
if (_typed_link__WEBPACK_IMPORTED_MODULE_9__.EMAIL.test(value)) {
|
|
41399
41549
|
return `mailto:${value}`;
|
|
41400
41550
|
}
|
|
41401
41551
|
// bare domain like example.com or www.example.com/path -> https://
|
|
@@ -41408,14 +41558,14 @@ function writeClasses(modeClassName, className_input, className_select, a) {
|
|
|
41408
41558
|
if (modeClassName && (className_input !== null && className_input !== void 0 ? className_input : className_select)) {
|
|
41409
41559
|
if (modeClassName === 'input') {
|
|
41410
41560
|
if (className_input.value === '' && a.hasAttribute('class')) {
|
|
41411
|
-
(0,
|
|
41561
|
+
(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'class', null);
|
|
41412
41562
|
}
|
|
41413
41563
|
if (className_input.value !== '') {
|
|
41414
|
-
(0,
|
|
41564
|
+
(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'class', className_input.value);
|
|
41415
41565
|
}
|
|
41416
41566
|
} else if (modeClassName === 'select') {
|
|
41417
41567
|
if (a.hasAttribute('class')) {
|
|
41418
|
-
(0,
|
|
41568
|
+
(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'class', null);
|
|
41419
41569
|
}
|
|
41420
41570
|
for(let i = 0; i < className_select.selectedOptions.length; i++){
|
|
41421
41571
|
var _className_select_selectedOptions_item;
|
|
@@ -41433,7 +41583,7 @@ function readClassnames(modeClassName, className_input, link, className_select)
|
|
|
41433
41583
|
switch(modeClassName){
|
|
41434
41584
|
case 'input':
|
|
41435
41585
|
if (className_input) {
|
|
41436
|
-
className_input.value = (0,
|
|
41586
|
+
className_input.value = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(link, 'class') || '';
|
|
41437
41587
|
}
|
|
41438
41588
|
break;
|
|
41439
41589
|
case 'select':
|
|
@@ -41444,7 +41594,7 @@ function readClassnames(modeClassName, className_input, link, className_select)
|
|
|
41444
41594
|
option.selected = false;
|
|
41445
41595
|
}
|
|
41446
41596
|
}
|
|
41447
|
-
const classNames = (0,
|
|
41597
|
+
const classNames = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(link, 'class') || '';
|
|
41448
41598
|
classNames.split(/\s+/).filter((cn)=>cn.trim().length > 0).forEach((className)=>{
|
|
41449
41599
|
if (className) {
|
|
41450
41600
|
for(let i = 0; i < className_select.options.length; i++){
|
|
@@ -41575,6 +41725,156 @@ const formTemplate = (editor)=>{
|
|
|
41575
41725
|
/* harmony export */ ]);
|
|
41576
41726
|
|
|
41577
41727
|
|
|
41728
|
+
/***/ }),
|
|
41729
|
+
|
|
41730
|
+
/***/ 4441:
|
|
41731
|
+
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
41732
|
+
|
|
41733
|
+
"use strict";
|
|
41734
|
+
/*!
|
|
41735
|
+
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
41736
|
+
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
41737
|
+
* Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
|
|
41738
|
+
*/ /**
|
|
41739
|
+
* @module plugins/link
|
|
41740
|
+
*/ /**
|
|
41741
|
+
* The endings a bare domain links with, besides those `link.typedLinkTlds`
|
|
41742
|
+
* adds: the generic ones of at least 1 in 1,000 of the sites in Tranco's top
|
|
41743
|
+
* million (list GQ38K, https://tranco-list.eu/list/GQ38K), then every
|
|
41744
|
+
* two-letter one in IANA's list (version 2026102900,
|
|
41745
|
+
* https://data.iana.org/TLD/tlds-alpha-by-domain.txt). Together they're the
|
|
41746
|
+
* endings of 96% of those sites
|
|
41747
|
+
* @private
|
|
41748
|
+
*/ const TLDS = new Set(`
|
|
41749
|
+
app biz casino click cloud club com dev edu gov info live net online org pro
|
|
41750
|
+
shop site space store tech top vip xyz
|
|
41751
|
+
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
|
|
41752
|
+
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
|
|
41753
|
+
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
|
|
41754
|
+
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
|
|
41755
|
+
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
|
|
41756
|
+
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
|
|
41757
|
+
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
|
|
41758
|
+
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
|
|
41759
|
+
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
|
|
41760
|
+
tv tw tz ua ug uk us uy uz va vc ve vg vi vn vu wf ws ye yt za zm zw
|
|
41761
|
+
`.trim().split(/\s+/));
|
|
41762
|
+
|
|
41763
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, [
|
|
41764
|
+
/* harmony export */ "TLDS", 0, /* binding */ TLDS
|
|
41765
|
+
/* harmony export */ ]);
|
|
41766
|
+
|
|
41767
|
+
|
|
41768
|
+
/***/ }),
|
|
41769
|
+
|
|
41770
|
+
/***/ 99763:
|
|
41771
|
+
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
41772
|
+
|
|
41773
|
+
"use strict";
|
|
41774
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
41775
|
+
/* harmony export */ findTypedLink: function() { return /* binding */ findTypedLink; }
|
|
41776
|
+
/* harmony export */ });
|
|
41777
|
+
/* harmony import */ var jodit_core_helpers_checker_is_url__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(91764);
|
|
41778
|
+
/* harmony import */ var _tlds__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4441);
|
|
41779
|
+
/*!
|
|
41780
|
+
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
41781
|
+
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
41782
|
+
* Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
|
|
41783
|
+
*/ /**
|
|
41784
|
+
* @module plugins/link
|
|
41785
|
+
*/
|
|
41786
|
+
|
|
41787
|
+
/**
|
|
41788
|
+
* An email address, for `mailto:`
|
|
41789
|
+
* @private
|
|
41790
|
+
*/ const EMAIL = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
41791
|
+
const OPENING = new Set([
|
|
41792
|
+
'(',
|
|
41793
|
+
'[',
|
|
41794
|
+
'"',
|
|
41795
|
+
"'",
|
|
41796
|
+
'“',
|
|
41797
|
+
'‘',
|
|
41798
|
+
'<'
|
|
41799
|
+
]);
|
|
41800
|
+
const CLOSING = new Set([
|
|
41801
|
+
'.',
|
|
41802
|
+
',',
|
|
41803
|
+
';',
|
|
41804
|
+
':',
|
|
41805
|
+
'!',
|
|
41806
|
+
'?',
|
|
41807
|
+
'"',
|
|
41808
|
+
"'",
|
|
41809
|
+
'”',
|
|
41810
|
+
'’',
|
|
41811
|
+
'>'
|
|
41812
|
+
]);
|
|
41813
|
+
const BRACKETS = {
|
|
41814
|
+
')': '(',
|
|
41815
|
+
']': '['
|
|
41816
|
+
};
|
|
41817
|
+
const LABEL = /^[a-z\d][a-z\d-]{0,62}$/i;
|
|
41818
|
+
/**
|
|
41819
|
+
* The address that ends at `end` in a line of text typed, back to the
|
|
41820
|
+
* whitespace before it, as `[start, end, href]`. Punctuation round it, such as
|
|
41821
|
+
* a sentence's full stop or a bracket the address doesn't open, stays out.
|
|
41822
|
+
* An address counts with a scheme, with `www.`, as an email address, or as a
|
|
41823
|
+
* bare domain that `isBareDomain` accepts, so `Node.js` or `e.g.` don't
|
|
41824
|
+
* @private
|
|
41825
|
+
*/ function findTypedLink(text, end, tlds, fileEndings) {
|
|
41826
|
+
let start = end;
|
|
41827
|
+
while(start > 0 && !/\s/.test(text[start - 1])){
|
|
41828
|
+
start -= 1;
|
|
41829
|
+
}
|
|
41830
|
+
while(start < end && OPENING.has(text[start])){
|
|
41831
|
+
start += 1;
|
|
41832
|
+
}
|
|
41833
|
+
while(end > start){
|
|
41834
|
+
const char = text[end - 1];
|
|
41835
|
+
const opening = BRACKETS[char];
|
|
41836
|
+
if (CLOSING.has(char) || opening && !text.slice(start, end - 1).includes(opening)) {
|
|
41837
|
+
end -= 1;
|
|
41838
|
+
} else {
|
|
41839
|
+
break;
|
|
41840
|
+
}
|
|
41841
|
+
}
|
|
41842
|
+
const href = typedLinkHref(text.slice(start, end), tlds, fileEndings);
|
|
41843
|
+
return href ? [
|
|
41844
|
+
start,
|
|
41845
|
+
end,
|
|
41846
|
+
href
|
|
41847
|
+
] : null;
|
|
41848
|
+
}
|
|
41849
|
+
function typedLinkHref(address, tlds, fileEndings) {
|
|
41850
|
+
const email = address.replace(/^mailto:/i, '');
|
|
41851
|
+
if (EMAIL.test(email)) {
|
|
41852
|
+
return `mailto:${email}`;
|
|
41853
|
+
}
|
|
41854
|
+
if (/^www\.[^\s.]+\.\S+$/i.test(address) || isBareDomain(address, tlds, fileEndings)) {
|
|
41855
|
+
return `https://${address}`;
|
|
41856
|
+
}
|
|
41857
|
+
return /^[a-z][a-z\d+.-]*:\/\//i.test(address) && (0,jodit_core_helpers_checker_is_url__WEBPACK_IMPORTED_MODULE_0__.isURL)(address) ? address : '';
|
|
41858
|
+
}
|
|
41859
|
+
/**
|
|
41860
|
+
* A domain typed without a scheme or `www.`, as `example.com`, `elections.nz`
|
|
41861
|
+
* or `bit.ly/enrol`. Its ending has to be in `TLDS` or `tlds`, typed in lower
|
|
41862
|
+
* case, so `Node.js` and a sentence run on, as in `home.It`, don't count, and
|
|
41863
|
+
* not in `fileEndings`, as in `photos.zip`. The first part has a letter,
|
|
41864
|
+
* which leaves out a time or a numbered step such as `11.am`
|
|
41865
|
+
*/ function isBareDomain(address, tlds, fileEndings) {
|
|
41866
|
+
const cut = address.search(/[/?#]/);
|
|
41867
|
+
const host = cut < 0 ? address : address.slice(0, cut);
|
|
41868
|
+
const labels = host.split('.');
|
|
41869
|
+
const ending = labels[labels.length - 1];
|
|
41870
|
+
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]);
|
|
41871
|
+
}
|
|
41872
|
+
|
|
41873
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, [
|
|
41874
|
+
/* harmony export */ "EMAIL", 0, /* binding */ EMAIL
|
|
41875
|
+
/* harmony export */ ]);
|
|
41876
|
+
|
|
41877
|
+
|
|
41578
41878
|
/***/ }),
|
|
41579
41879
|
|
|
41580
41880
|
/***/ 51730:
|