jodit 4.12.37 → 4.12.38
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 +11 -0
- package/es2015/jodit.css +1 -1
- package/es2015/jodit.fat.min.js +3 -3
- package/es2015/jodit.js +52 -2
- package/es2015/jodit.min.js +5 -5
- 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 +3 -3
- package/es2018/jodit.min.js +5 -5
- 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 +5 -5
- package/es2021/jodit.js +52 -2
- package/es2021/jodit.min.js +7 -7
- 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 +5 -5
- package/es2021.en/jodit.js +52 -2
- package/es2021.en/jodit.min.js +5 -5
- 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 +52 -2
- 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 +22 -0
- package/esm/config.js +14 -0
- package/esm/core/constants.js +1 -1
- package/esm/core/global.js +4 -0
- package/esm/core/helpers/utils/append-script.js +6 -0
- package/esm/plugins/link/config.d.ts +8 -0
- package/esm/plugins/link/config.js +1 -0
- package/esm/plugins/link/link.js +30 -0
- package/esm/types/view.d.ts +6 -0
- package/package.json +1 -1
- package/types/config.d.ts +22 -0
- package/types/plugins/link/config.d.ts +8 -0
- package/types/types/view.d.ts +6 -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.12.
|
|
4
|
+
* Version: v4.12.38
|
|
5
5
|
* Url: https://xdsoft.net/jodit/
|
|
6
6
|
* License(s): MIT
|
|
7
7
|
*/
|
|
@@ -300,6 +300,19 @@ let ConfigPrototype = {};
|
|
|
300
300
|
* editor.value = '<p>start</p>';
|
|
301
301
|
* ```
|
|
302
302
|
*/ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "shadowRoot", null);
|
|
303
|
+
/**
|
|
304
|
+
* CSP nonce applied to every `<style>`, `<script>` and `<link>` element
|
|
305
|
+
* Jodit injects at runtime (plugin styles, CDN scripts for ACE/beautify,
|
|
306
|
+
* downloaded stylesheets). Set it to the same nonce your server puts in the
|
|
307
|
+
* `Content-Security-Policy` header so a strict `style-src`/`script-src`
|
|
308
|
+
* policy does not block the editor.
|
|
309
|
+
*
|
|
310
|
+
* ```js
|
|
311
|
+
* Jodit.make('#editor', {
|
|
312
|
+
* nonce: 'r4nd0m'
|
|
313
|
+
* });
|
|
314
|
+
* ```
|
|
315
|
+
*/ (0,_swc_helpers_define_property__WEBPACK_IMPORTED_MODULE_0__._)(this, "nonce", '');
|
|
303
316
|
/**
|
|
304
317
|
* Base CSS `z-index` for the editor UI (toolbar, popups, dialogs).
|
|
305
318
|
* Set to a higher value when other page elements overlap the editor.
|
|
@@ -1816,7 +1829,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1816
1829
|
* ```
|
|
1817
1830
|
* @packageDocumentation
|
|
1818
1831
|
* @module constants
|
|
1819
|
-
*/ const APP_VERSION = "4.12.
|
|
1832
|
+
*/ const APP_VERSION = "4.12.38";
|
|
1820
1833
|
// prettier-ignore
|
|
1821
1834
|
const ES = "es2015";
|
|
1822
1835
|
const IS_ES_MODERN = true;
|
|
@@ -4778,6 +4791,10 @@ const boxes = new WeakMap();
|
|
|
4778
4791
|
const box = c.element(tag, {
|
|
4779
4792
|
className: `jodit jodit-${(0,jodit_core_helpers_string_kebab_case__WEBPACK_IMPORTED_MODULE_3__.kebabCase)(name)}-container jodit-box`
|
|
4780
4793
|
});
|
|
4794
|
+
// Let a strict CSP accept the injected <style>/<script> box
|
|
4795
|
+
if (view.o.nonce && (tag === 'style' || tag === 'script')) {
|
|
4796
|
+
box.setAttribute('nonce', view.o.nonce);
|
|
4797
|
+
}
|
|
4781
4798
|
box.classList.add(`jodit_theme_${view.o.theme || 'default'}`);
|
|
4782
4799
|
body.appendChild(box);
|
|
4783
4800
|
data[key] = box;
|
|
@@ -7601,6 +7618,9 @@ const cacheLoaders = (loader)=>{
|
|
|
7601
7618
|
async: true,
|
|
7602
7619
|
src: (0,_complete_url__WEBPACK_IMPORTED_MODULE_1__.completeUrl)(url)
|
|
7603
7620
|
});
|
|
7621
|
+
if (jodit.o.nonce) {
|
|
7622
|
+
script.setAttribute('nonce', jodit.o.nonce);
|
|
7623
|
+
}
|
|
7604
7624
|
jodit.e.one(script, 'error', reject).one(script, 'load', resolve);
|
|
7605
7625
|
jodit.od.body.appendChild(script);
|
|
7606
7626
|
});
|
|
@@ -7616,6 +7636,9 @@ const cacheLoaders = (loader)=>{
|
|
|
7616
7636
|
link.rel = 'stylesheet';
|
|
7617
7637
|
link.media = 'all';
|
|
7618
7638
|
link.crossOrigin = 'anonymous';
|
|
7639
|
+
if (jodit.o.nonce) {
|
|
7640
|
+
link.setAttribute('nonce', jodit.o.nonce);
|
|
7641
|
+
}
|
|
7619
7642
|
const callback = ()=>resolve(link);
|
|
7620
7643
|
!jodit.isInDestruct && jodit.e.on(link, 'load', callback).on(link, 'error', reject);
|
|
7621
7644
|
link.href = (0,_complete_url__WEBPACK_IMPORTED_MODULE_1__.completeUrl)(url);
|
|
@@ -35842,6 +35865,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.link = {
|
|
|
35842
35865
|
followOnDblClick: false,
|
|
35843
35866
|
processVideoLink: true,
|
|
35844
35867
|
processPastedLink: true,
|
|
35868
|
+
deriveUrlFromText: false,
|
|
35845
35869
|
noFollowCheckbox: true,
|
|
35846
35870
|
openInNewTabCheckbox: true,
|
|
35847
35871
|
openInNewTabCheckboxDefaultChecked: false,
|
|
@@ -36043,6 +36067,9 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
36043
36067
|
insert.textContent = i18n('Update');
|
|
36044
36068
|
} else {
|
|
36045
36069
|
jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.hide(unlink);
|
|
36070
|
+
if (jodit.o.link.deriveUrlFromText && url_input && !isImageContent && !url_input.value.trim()) {
|
|
36071
|
+
url_input.value = guessUrlFromText(content_input.value);
|
|
36072
|
+
}
|
|
36046
36073
|
if (openInNewTabCheckbox && target_checkbox) {
|
|
36047
36074
|
target_checkbox.checked = openInNewTabCheckboxDefaultChecked;
|
|
36048
36075
|
}
|
|
@@ -36169,6 +36196,29 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
36169
36196
|
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_2__.autobind
|
|
36170
36197
|
], link.prototype, "__onClickReadOnlyLink", null);
|
|
36171
36198
|
jodit_core_global__WEBPACK_IMPORTED_MODULE_4__.pluginSystem.add('link', link);
|
|
36199
|
+
/**
|
|
36200
|
+
* Guess a usable `href` from the selected text for the link dialog.
|
|
36201
|
+
* Returns an empty string when the text is not a plausible URL/email,
|
|
36202
|
+
* so plain text (e.g. "click here") is left untouched.
|
|
36203
|
+
*/ function guessUrlFromText(text) {
|
|
36204
|
+
const value = text.trim();
|
|
36205
|
+
if (!value || /\s/.test(value)) {
|
|
36206
|
+
return '';
|
|
36207
|
+
}
|
|
36208
|
+
// already an explicit scheme, an anchor or a relative path
|
|
36209
|
+
if (/^(https?:|mailto:|tel:|ftp:|#|\/|\.{1,2}\/)/i.test(value)) {
|
|
36210
|
+
return value;
|
|
36211
|
+
}
|
|
36212
|
+
// email address -> mailto:
|
|
36213
|
+
if (/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value)) {
|
|
36214
|
+
return `mailto:${value}`;
|
|
36215
|
+
}
|
|
36216
|
+
// bare domain like example.com or www.example.com/path -> https://
|
|
36217
|
+
if (/^[a-z0-9-]+(\.[a-z0-9-]+)+(\/\S*)?$/i.test(value)) {
|
|
36218
|
+
return `https://${value}`;
|
|
36219
|
+
}
|
|
36220
|
+
return '';
|
|
36221
|
+
}
|
|
36172
36222
|
function writeClasses(modeClassName, className_input, className_select, a) {
|
|
36173
36223
|
if (modeClassName && (className_input !== null && className_input !== void 0 ? className_input : className_select)) {
|
|
36174
36224
|
if (modeClassName === 'input') {
|