jodit 4.19.4 → 4.19.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/es2015/jodit.css +1 -1
- package/es2015/jodit.fat.min.js +20 -7
- package/es2015/jodit.js +393 -56
- package/es2015/jodit.min.js +17 -4
- package/es2015/plugins/debug/debug.css +1 -1
- package/es2015/plugins/debug/debug.js +1 -1
- package/es2015/plugins/debug/debug.min.js +1 -1
- package/es2015/plugins/speech-recognize/speech-recognize.css +1 -1
- package/es2015/plugins/speech-recognize/speech-recognize.js +1 -1
- package/es2015/plugins/speech-recognize/speech-recognize.min.js +1 -1
- package/es2018/jodit.fat.min.js +17 -4
- package/es2018/jodit.min.js +17 -4
- package/es2018/plugins/debug/debug.min.js +1 -1
- package/es2018/plugins/speech-recognize/speech-recognize.min.js +1 -1
- package/es2021/jodit.css +1 -1
- package/es2021/jodit.fat.min.js +18 -5
- package/es2021/jodit.js +390 -56
- package/es2021/jodit.min.js +18 -5
- package/es2021/plugins/debug/debug.css +1 -1
- package/es2021/plugins/debug/debug.js +1 -1
- package/es2021/plugins/debug/debug.min.js +1 -1
- package/es2021/plugins/speech-recognize/speech-recognize.css +1 -1
- package/es2021/plugins/speech-recognize/speech-recognize.js +1 -1
- package/es2021/plugins/speech-recognize/speech-recognize.min.js +1 -1
- package/es2021.en/jodit.css +1 -1
- package/es2021.en/jodit.fat.min.js +20 -7
- package/es2021.en/jodit.js +390 -56
- package/es2021.en/jodit.min.js +20 -7
- package/es2021.en/plugins/debug/debug.css +1 -1
- package/es2021.en/plugins/debug/debug.js +1 -1
- package/es2021.en/plugins/debug/debug.min.js +1 -1
- package/es2021.en/plugins/speech-recognize/speech-recognize.css +1 -1
- package/es2021.en/plugins/speech-recognize/speech-recognize.js +1 -1
- package/es2021.en/plugins/speech-recognize/speech-recognize.min.js +1 -1
- package/es5/jodit.css +2 -2
- package/es5/jodit.fat.min.js +2 -2
- package/es5/jodit.js +410 -62
- package/es5/jodit.min.css +2 -2
- package/es5/jodit.min.js +2 -2
- package/es5/plugins/debug/debug.css +1 -1
- package/es5/plugins/debug/debug.js +1 -1
- package/es5/plugins/debug/debug.min.js +1 -1
- package/es5/plugins/speech-recognize/speech-recognize.css +1 -1
- package/es5/plugins/speech-recognize/speech-recognize.js +1 -1
- package/es5/plugins/speech-recognize/speech-recognize.min.js +1 -1
- package/es5/polyfills.fat.min.js +1 -1
- package/es5/polyfills.js +1 -1
- package/es5/polyfills.min.js +1 -1
- package/esm/config.d.ts +31 -0
- package/esm/core/constants.js +1 -1
- package/esm/core/selection/helpers/move-node-inside-start.js +5 -2
- package/esm/plugins/file/file.js +39 -3
- package/esm/plugins/link/config.d.ts +31 -0
- package/esm/plugins/link/config.js +3 -0
- package/esm/plugins/link/link.d.ts +27 -0
- package/esm/plugins/link/link.js +144 -2
- package/esm/plugins/link/tlds.d.ts +18 -0
- package/esm/plugins/link/tlds.js +33 -0
- package/esm/plugins/link/typed-link.d.ts +23 -0
- package/esm/plugins/link/typed-link.js +92 -0
- package/package.json +1 -1
- package/types/config.d.ts +31 -0
- package/types/plugins/link/config.d.ts +31 -0
- package/types/plugins/link/link.d.ts +27 -0
- package/types/plugins/link/tlds.d.ts +18 -0
- package/types/plugins/link/typed-link.d.ts +23 -0
package/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);
|
|
@@ -34266,11 +34272,35 @@ function brBefore(start) {
|
|
|
34266
34272
|
|
|
34267
34273
|
|
|
34268
34274
|
|
|
34275
|
+
/**
|
|
34276
|
+
* Selected text becomes the link's text, as the Link button does, instead
|
|
34277
|
+
* of being replaced by the file's name. Returns false with nothing selected
|
|
34278
|
+
*/ function wrapSelectionInLink(editor, href, title = '') {
|
|
34279
|
+
if (editor.s.isCollapsed()) {
|
|
34280
|
+
return false;
|
|
34281
|
+
}
|
|
34282
|
+
const links = editor.s.wrapInTag('a');
|
|
34283
|
+
if (!links.length) {
|
|
34284
|
+
return false;
|
|
34285
|
+
}
|
|
34286
|
+
links.forEach((link)=>{
|
|
34287
|
+
;(0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_2__.attr)(link, 'href', href);
|
|
34288
|
+
if (title) {
|
|
34289
|
+
(0,jodit_core_helpers_utils_attr__WEBPACK_IMPORTED_MODULE_2__.attr)(link, 'title', title);
|
|
34290
|
+
}
|
|
34291
|
+
});
|
|
34292
|
+
editor.s.setCursorAfter(links[links.length - 1]);
|
|
34293
|
+
return true;
|
|
34294
|
+
}
|
|
34269
34295
|
function insertLinks(data) {
|
|
34270
34296
|
var _data_files;
|
|
34271
34297
|
(_data_files = data.files) === null || _data_files === void 0 ? void 0 : _data_files.forEach((file)=>{
|
|
34298
|
+
const href = data.baseurl + file;
|
|
34299
|
+
if (wrapSelectionInLink(this, href)) {
|
|
34300
|
+
return;
|
|
34301
|
+
}
|
|
34272
34302
|
const link = this.createInside.element('a', {
|
|
34273
|
-
href
|
|
34303
|
+
href
|
|
34274
34304
|
});
|
|
34275
34305
|
link.textContent = this.o.uploader.getDisplayName.call(this.uploader, data.baseurl, file);
|
|
34276
34306
|
this.s.insertNode(link);
|
|
@@ -34281,7 +34311,19 @@ jodit_config__WEBPACK_IMPORTED_MODULE_3__.Config.prototype.file = {
|
|
|
34281
34311
|
};
|
|
34282
34312
|
jodit_config__WEBPACK_IMPORTED_MODULE_3__.Config.prototype.controls.file = {
|
|
34283
34313
|
popup: (editor, current, close)=>{
|
|
34314
|
+
// The popup's first field takes the focus, so the selection the
|
|
34315
|
+
// popup was opened for is kept and put back before the link goes in
|
|
34316
|
+
const selected = editor.s.isCollapsed() ? null : editor.s.range;
|
|
34317
|
+
const restoreSelection = ()=>{
|
|
34318
|
+
if (selected) {
|
|
34319
|
+
editor.s.selectRange(selected);
|
|
34320
|
+
}
|
|
34321
|
+
};
|
|
34284
34322
|
const insert = (url, title = '')=>{
|
|
34323
|
+
restoreSelection();
|
|
34324
|
+
if (wrapSelectionInLink(editor, url, title)) {
|
|
34325
|
+
return;
|
|
34326
|
+
}
|
|
34285
34327
|
editor.s.insertNode(editor.createInside.fromHTML(`<a href="${url}" title="${title}">${title || url}</a>`));
|
|
34286
34328
|
};
|
|
34287
34329
|
let sourceAnchor = null;
|
|
@@ -34296,6 +34338,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_3__.Config.prototype.controls.file = {
|
|
|
34296
34338
|
upload: (data)=>{
|
|
34297
34339
|
var _ref;
|
|
34298
34340
|
var _editor_o_file;
|
|
34341
|
+
restoreSelection();
|
|
34299
34342
|
((_ref = (_editor_o_file = editor.o.file) === null || _editor_o_file === void 0 ? void 0 : _editor_o_file.defaultHandlerSuccess) !== null && _ref !== void 0 ? _ref : insertLinks).call(editor, data);
|
|
34300
34343
|
},
|
|
34301
34344
|
url: (url, text)=>{
|
|
@@ -41003,6 +41046,16 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.link = {
|
|
|
41003
41046
|
followOnDblClick: false,
|
|
41004
41047
|
processVideoLink: true,
|
|
41005
41048
|
processPastedLink: true,
|
|
41049
|
+
processTypedLink: false,
|
|
41050
|
+
typedLinkTlds: [],
|
|
41051
|
+
typedLinkFileEndings: [
|
|
41052
|
+
'zip',
|
|
41053
|
+
'mov',
|
|
41054
|
+
'md',
|
|
41055
|
+
'py',
|
|
41056
|
+
'sh',
|
|
41057
|
+
'pub'
|
|
41058
|
+
],
|
|
41006
41059
|
deriveUrlFromText: false,
|
|
41007
41060
|
noFollowCheckbox: true,
|
|
41008
41061
|
openInNewTabCheckbox: true,
|
|
@@ -41054,12 +41107,14 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
41054
41107
|
/* unused harmony export link */
|
|
41055
41108
|
/* harmony import */ var _swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(25045);
|
|
41056
41109
|
/* harmony import */ var _swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(31635);
|
|
41057
|
-
/* harmony import */ var
|
|
41058
|
-
/* harmony import */ var
|
|
41059
|
-
/* harmony import */ var
|
|
41060
|
-
/* harmony import */ var
|
|
41061
|
-
/* harmony import */ var
|
|
41062
|
-
/* 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);
|
|
41063
41118
|
/*!
|
|
41064
41119
|
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
41065
41120
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
@@ -41076,9 +41131,11 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
41076
41131
|
|
|
41077
41132
|
|
|
41078
41133
|
|
|
41134
|
+
|
|
41135
|
+
|
|
41079
41136
|
/**
|
|
41080
41137
|
* Process link. Insert, dblclick or remove format
|
|
41081
|
-
*/ class link extends
|
|
41138
|
+
*/ class link extends jodit_core_plugin__WEBPACK_IMPORTED_MODULE_7__.Plugin {
|
|
41082
41139
|
/** @override */ afterInit(jodit) {
|
|
41083
41140
|
if (jodit.o.link.followOnDblClick) {
|
|
41084
41141
|
jodit.e.on('dblclick.link', this.__onDblClickOnLink);
|
|
@@ -41087,6 +41144,14 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
41087
41144
|
if (jodit.o.link.processPastedLink) {
|
|
41088
41145
|
jodit.e.on('processPaste.link', this.onProcessPasteLink);
|
|
41089
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
|
+
}
|
|
41090
41155
|
jodit.e.on('generateLinkForm.link', this.__generateForm);
|
|
41091
41156
|
jodit.registerCommand('openLinkDialog', {
|
|
41092
41157
|
exec: ()=>{
|
|
@@ -41100,7 +41165,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
41100
41165
|
dialog.setContent(htmlForm);
|
|
41101
41166
|
dialog.open();
|
|
41102
41167
|
jodit.async.requestIdleCallback(()=>{
|
|
41103
|
-
const { url_input } = (0,
|
|
41168
|
+
const { url_input } = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.refs)(htmlForm.container);
|
|
41104
41169
|
url_input === null || url_input === void 0 ? void 0 : url_input.focus();
|
|
41105
41170
|
});
|
|
41106
41171
|
},
|
|
@@ -41108,10 +41173,10 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
41108
41173
|
});
|
|
41109
41174
|
}
|
|
41110
41175
|
__onDblClickOnLink(e) {
|
|
41111
|
-
if (!
|
|
41176
|
+
if (!jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isTag(e.target, 'a')) {
|
|
41112
41177
|
return;
|
|
41113
41178
|
}
|
|
41114
|
-
const href = (0,
|
|
41179
|
+
const href = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(e.target, 'href');
|
|
41115
41180
|
if (href) {
|
|
41116
41181
|
location.href = href;
|
|
41117
41182
|
e.preventDefault();
|
|
@@ -41119,25 +41184,25 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
41119
41184
|
}
|
|
41120
41185
|
onProcessPasteLink(ignore, html) {
|
|
41121
41186
|
const { jodit } = this;
|
|
41122
|
-
if (!(0,
|
|
41187
|
+
if (!(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.isURL)(html) || !jodit.o.link.processPastedLink) {
|
|
41123
41188
|
return;
|
|
41124
41189
|
}
|
|
41125
41190
|
jodit.e.stopPropagation('processPaste');
|
|
41126
41191
|
if (jodit.o.link.processVideoLink) {
|
|
41127
41192
|
var _ref;
|
|
41128
41193
|
var _jodit_o_video, _jodit_o_video1, _jodit_o_video2;
|
|
41129
|
-
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, {
|
|
41130
41195
|
width: (_jodit_o_video1 = jodit.o.video) === null || _jodit_o_video1 === void 0 ? void 0 : _jodit_o_video1.defaultWidth,
|
|
41131
41196
|
height: (_jodit_o_video2 = jodit.o.video) === null || _jodit_o_video2 === void 0 ? void 0 : _jodit_o_video2.defaultHeight
|
|
41132
41197
|
});
|
|
41133
41198
|
if (embed !== html) {
|
|
41134
|
-
const media = (0,
|
|
41135
|
-
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;
|
|
41136
41201
|
}
|
|
41137
41202
|
}
|
|
41138
41203
|
if (jodit.s.isCollapsed()) {
|
|
41139
41204
|
const a = jodit.createInside.element('a');
|
|
41140
|
-
(0,
|
|
41205
|
+
(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'href', html);
|
|
41141
41206
|
a.textContent = html;
|
|
41142
41207
|
jodit.e.fire('applyLink', jodit, a, null);
|
|
41143
41208
|
return a;
|
|
@@ -41155,16 +41220,16 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
41155
41220
|
const i18n = jodit.i18n.bind(jodit);
|
|
41156
41221
|
const { openInNewTabCheckbox, openInNewTabCheckboxDefaultChecked, noFollowCheckbox, formTemplate, formClassName, modeClassName } = jodit.o.link;
|
|
41157
41222
|
const html = formTemplate(jodit);
|
|
41158
|
-
const form = (0,
|
|
41223
|
+
const form = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.isString)(html) ? jodit.c.fromHTML(html, {
|
|
41159
41224
|
target_checkbox_box: openInNewTabCheckbox,
|
|
41160
41225
|
nofollow_checkbox_box: noFollowCheckbox
|
|
41161
41226
|
}) : html;
|
|
41162
|
-
const htmlForm =
|
|
41163
|
-
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);
|
|
41164
41229
|
const { insert, unlink, content_input_box } = elements;
|
|
41165
41230
|
const { target_checkbox, nofollow_checkbox, url_input } = elements;
|
|
41166
41231
|
const currentElement = current;
|
|
41167
|
-
const isImageContent =
|
|
41232
|
+
const isImageContent = jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isImage(currentElement);
|
|
41168
41233
|
let { content_input } = elements;
|
|
41169
41234
|
const { className_input } = elements, { className_select } = elements, { aria_label_input } = elements;
|
|
41170
41235
|
if (!content_input) {
|
|
@@ -41177,12 +41242,12 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
41177
41242
|
htmlForm.classList.add(formClassName);
|
|
41178
41243
|
}
|
|
41179
41244
|
if (isImageContent) {
|
|
41180
|
-
|
|
41245
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.hide(content_input_box);
|
|
41181
41246
|
}
|
|
41182
41247
|
let link;
|
|
41183
|
-
const getSelectionText = ()=>link ? link.innerText : (0,
|
|
41184
|
-
if (current &&
|
|
41185
|
-
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);
|
|
41186
41251
|
} else {
|
|
41187
41252
|
link = false;
|
|
41188
41253
|
}
|
|
@@ -41190,22 +41255,22 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
41190
41255
|
content_input.value = getSelectionText();
|
|
41191
41256
|
}
|
|
41192
41257
|
if (aria_label_input) {
|
|
41193
|
-
aria_label_input.value = link ? (0,
|
|
41258
|
+
aria_label_input.value = link ? (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(link, 'aria-label') || '' : '';
|
|
41194
41259
|
}
|
|
41195
41260
|
if (link) {
|
|
41196
|
-
url_input.value = (0,
|
|
41261
|
+
url_input.value = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(link, 'href') || '';
|
|
41197
41262
|
if (modeClassName) {
|
|
41198
41263
|
readClassnames(modeClassName, className_input, link, className_select);
|
|
41199
41264
|
}
|
|
41200
41265
|
if (openInNewTabCheckbox && target_checkbox) {
|
|
41201
|
-
target_checkbox.checked = (0,
|
|
41266
|
+
target_checkbox.checked = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(link, 'target') === '_blank';
|
|
41202
41267
|
}
|
|
41203
41268
|
if (noFollowCheckbox && nofollow_checkbox) {
|
|
41204
|
-
nofollow_checkbox.checked = ((0,
|
|
41269
|
+
nofollow_checkbox.checked = ((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(link, 'rel') || '').split(/\s+/).includes('nofollow');
|
|
41205
41270
|
}
|
|
41206
41271
|
insert.textContent = i18n('Update');
|
|
41207
41272
|
} else {
|
|
41208
|
-
|
|
41273
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.hide(unlink);
|
|
41209
41274
|
if (jodit.o.link.deriveUrlFromText && url_input && !isImageContent && !url_input.value.trim()) {
|
|
41210
41275
|
url_input.value = guessUrlFromText(content_input.value);
|
|
41211
41276
|
}
|
|
@@ -41220,7 +41285,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
41220
41285
|
jodit.s.restore();
|
|
41221
41286
|
jodit.history.snapshot.restore(snapshot);
|
|
41222
41287
|
if (link) {
|
|
41223
|
-
|
|
41288
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.unwrap(link);
|
|
41224
41289
|
}
|
|
41225
41290
|
jodit.synchronizeValues();
|
|
41226
41291
|
close();
|
|
@@ -41241,12 +41306,12 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
41241
41306
|
const textWasChanged = getSelectionText() !== content_input.value.trim();
|
|
41242
41307
|
const ci = jodit.createInside;
|
|
41243
41308
|
let caretAfter = null;
|
|
41244
|
-
if (!link || !
|
|
41309
|
+
if (!link || !jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isOrContains(jodit.editor, link)) {
|
|
41245
41310
|
if (!jodit.s.isCollapsed()) {
|
|
41246
41311
|
const node = jodit.s.current();
|
|
41247
|
-
if (
|
|
41312
|
+
if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isTag(node, 'img')) {
|
|
41248
41313
|
links = [
|
|
41249
|
-
|
|
41314
|
+
jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.wrap(node, 'a', ci)
|
|
41250
41315
|
];
|
|
41251
41316
|
} else {
|
|
41252
41317
|
links = jodit.s.wrapInTag('a');
|
|
@@ -41266,27 +41331,27 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
41266
41331
|
];
|
|
41267
41332
|
}
|
|
41268
41333
|
links.forEach((a)=>{
|
|
41269
|
-
;(0,
|
|
41334
|
+
;(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'href', url_input.value);
|
|
41270
41335
|
writeClasses(modeClassName, className_input, className_select, a);
|
|
41271
41336
|
if (!isImageContent) {
|
|
41272
41337
|
writeImage(a, content_input, textWasChanged, url_input);
|
|
41273
41338
|
}
|
|
41274
41339
|
if (openInNewTabCheckbox && target_checkbox) {
|
|
41275
|
-
(0,
|
|
41340
|
+
(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'target', target_checkbox.checked ? '_blank' : null);
|
|
41276
41341
|
}
|
|
41277
41342
|
if (noFollowCheckbox && nofollow_checkbox) {
|
|
41278
|
-
const relParts = ((0,
|
|
41343
|
+
const relParts = ((0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'rel') || '').split(/\s+/).filter(Boolean);
|
|
41279
41344
|
const hasNofollow = relParts.includes('nofollow');
|
|
41280
41345
|
if (nofollow_checkbox.checked && !hasNofollow) {
|
|
41281
41346
|
relParts.push('nofollow');
|
|
41282
41347
|
} else if (!nofollow_checkbox.checked && hasNofollow) {
|
|
41283
41348
|
relParts.splice(relParts.indexOf('nofollow'), 1);
|
|
41284
41349
|
}
|
|
41285
|
-
;(0,
|
|
41350
|
+
;(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'rel', relParts.length ? relParts.join(' ') : null);
|
|
41286
41351
|
}
|
|
41287
41352
|
if (aria_label_input) {
|
|
41288
41353
|
const ariaLabel = aria_label_input.value.trim();
|
|
41289
|
-
(0,
|
|
41354
|
+
(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'aria-label', ariaLabel || null);
|
|
41290
41355
|
}
|
|
41291
41356
|
jodit.e.fire('applyLink', jodit, a, form);
|
|
41292
41357
|
});
|
|
@@ -41301,7 +41366,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
41301
41366
|
close();
|
|
41302
41367
|
return false;
|
|
41303
41368
|
};
|
|
41304
|
-
if (
|
|
41369
|
+
if (jodit_core_dom__WEBPACK_IMPORTED_MODULE_4__.Dom.isElement(form)) {
|
|
41305
41370
|
jodit.e.on(form, 'submit', (event)=>{
|
|
41306
41371
|
event.preventDefault();
|
|
41307
41372
|
event.stopImmediatePropagation();
|
|
@@ -41314,11 +41379,96 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
41314
41379
|
return form;
|
|
41315
41380
|
}
|
|
41316
41381
|
/** @override */ beforeDestruct(jodit) {
|
|
41317
|
-
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');
|
|
41318
41468
|
}
|
|
41319
41469
|
__onClickReadOnlyLink(e) {
|
|
41320
41470
|
const { jodit } = this;
|
|
41321
|
-
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')) {
|
|
41322
41472
|
e.preventDefault();
|
|
41323
41473
|
}
|
|
41324
41474
|
}
|
|
@@ -41328,22 +41478,59 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
41328
41478
|
name: 'link',
|
|
41329
41479
|
group: 'insert'
|
|
41330
41480
|
}
|
|
41331
|
-
])
|
|
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);
|
|
41332
41489
|
}
|
|
41333
41490
|
}
|
|
41334
41491
|
;(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
41335
|
-
|
|
41492
|
+
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
|
|
41336
41493
|
], link.prototype, "__onDblClickOnLink", null);
|
|
41337
41494
|
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
41338
|
-
|
|
41495
|
+
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
|
|
41339
41496
|
], link.prototype, "onProcessPasteLink", null);
|
|
41340
41497
|
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
41341
|
-
|
|
41498
|
+
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_3__.autobind
|
|
41342
41499
|
], link.prototype, "__generateForm", null);
|
|
41343
41500
|
(0,_swc_helpers_ts_decorate__WEBPACK_IMPORTED_MODULE_1__.__decorate)([
|
|
41344
|
-
|
|
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
|
|
41345
41520
|
], link.prototype, "__onClickReadOnlyLink", null);
|
|
41346
|
-
|
|
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);
|
|
41347
41534
|
/**
|
|
41348
41535
|
* Guess a usable `href` from the selected text for the link dialog.
|
|
41349
41536
|
* Returns an empty string when the text is not a plausible URL/email,
|
|
@@ -41358,7 +41545,7 @@ jodit_core_global__WEBPACK_IMPORTED_MODULE_4__.pluginSystem.add('link', link);
|
|
|
41358
41545
|
return value;
|
|
41359
41546
|
}
|
|
41360
41547
|
// email address -> mailto:
|
|
41361
|
-
if (
|
|
41548
|
+
if (_typed_link__WEBPACK_IMPORTED_MODULE_9__.EMAIL.test(value)) {
|
|
41362
41549
|
return `mailto:${value}`;
|
|
41363
41550
|
}
|
|
41364
41551
|
// bare domain like example.com or www.example.com/path -> https://
|
|
@@ -41371,14 +41558,14 @@ function writeClasses(modeClassName, className_input, className_select, a) {
|
|
|
41371
41558
|
if (modeClassName && (className_input !== null && className_input !== void 0 ? className_input : className_select)) {
|
|
41372
41559
|
if (modeClassName === 'input') {
|
|
41373
41560
|
if (className_input.value === '' && a.hasAttribute('class')) {
|
|
41374
|
-
(0,
|
|
41561
|
+
(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'class', null);
|
|
41375
41562
|
}
|
|
41376
41563
|
if (className_input.value !== '') {
|
|
41377
|
-
(0,
|
|
41564
|
+
(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'class', className_input.value);
|
|
41378
41565
|
}
|
|
41379
41566
|
} else if (modeClassName === 'select') {
|
|
41380
41567
|
if (a.hasAttribute('class')) {
|
|
41381
|
-
(0,
|
|
41568
|
+
(0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(a, 'class', null);
|
|
41382
41569
|
}
|
|
41383
41570
|
for(let i = 0; i < className_select.selectedOptions.length; i++){
|
|
41384
41571
|
var _className_select_selectedOptions_item;
|
|
@@ -41396,7 +41583,7 @@ function readClassnames(modeClassName, className_input, link, className_select)
|
|
|
41396
41583
|
switch(modeClassName){
|
|
41397
41584
|
case 'input':
|
|
41398
41585
|
if (className_input) {
|
|
41399
|
-
className_input.value = (0,
|
|
41586
|
+
className_input.value = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(link, 'class') || '';
|
|
41400
41587
|
}
|
|
41401
41588
|
break;
|
|
41402
41589
|
case 'select':
|
|
@@ -41407,7 +41594,7 @@ function readClassnames(modeClassName, className_input, link, className_select)
|
|
|
41407
41594
|
option.selected = false;
|
|
41408
41595
|
}
|
|
41409
41596
|
}
|
|
41410
|
-
const classNames = (0,
|
|
41597
|
+
const classNames = (0,jodit_core_helpers__WEBPACK_IMPORTED_MODULE_6__.attr)(link, 'class') || '';
|
|
41411
41598
|
classNames.split(/\s+/).filter((cn)=>cn.trim().length > 0).forEach((className)=>{
|
|
41412
41599
|
if (className) {
|
|
41413
41600
|
for(let i = 0; i < className_select.options.length; i++){
|
|
@@ -41538,6 +41725,156 @@ const formTemplate = (editor)=>{
|
|
|
41538
41725
|
/* harmony export */ ]);
|
|
41539
41726
|
|
|
41540
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
|
+
|
|
41541
41878
|
/***/ }),
|
|
41542
41879
|
|
|
41543
41880
|
/***/ 51730:
|