jodit 4.12.37 → 4.12.39
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 +24 -0
- package/README.md +4 -4
- package/es2015/jodit.css +1 -1
- package/es2015/jodit.fat.min.js +4 -4
- package/es2015/jodit.js +69 -5
- 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 +4 -4
- 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 +6 -6
- package/es2021/jodit.js +69 -5
- 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 +6 -6
- package/es2021.en/jodit.js +69 -5
- package/es2021.en/jodit.min.js +6 -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 +69 -5
- 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/core/helpers/utils/scroll-into-view.js +6 -2
- package/esm/plugins/fullsize/fullsize.js +11 -1
- 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.39
|
|
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.39";
|
|
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);
|
|
@@ -9060,8 +9083,12 @@ const map = {};
|
|
|
9060
9083
|
return false;
|
|
9061
9084
|
}
|
|
9062
9085
|
}
|
|
9063
|
-
// Check it's within the document viewport
|
|
9064
|
-
|
|
9086
|
+
// Check it's within the document viewport: the element must not be below
|
|
9087
|
+
// the viewport bottom, and (its bottom) must not be above the viewport top —
|
|
9088
|
+
// the latter guard was missing, so an element scrolled above the top was
|
|
9089
|
+
// wrongly reported as visible and never scrolled to. See #1279
|
|
9090
|
+
const clientHeight = doc.documentElement && doc.documentElement.clientHeight || 0;
|
|
9091
|
+
return top <= clientHeight && top + height >= 0;
|
|
9065
9092
|
}
|
|
9066
9093
|
/**
|
|
9067
9094
|
* Scroll element into view if it is not in view
|
|
@@ -31585,7 +31612,7 @@ const fullsizeStack = new Set();
|
|
|
31585
31612
|
editor.registerButton({
|
|
31586
31613
|
name: 'fullsize'
|
|
31587
31614
|
});
|
|
31588
|
-
let isEnabled = false, oldHeight = 0, oldWidth = 0, wasToggled = false;
|
|
31615
|
+
let isEnabled = false, oldHeight = 0, oldWidth = 0, savedScrollLeft = 0, savedScrollTop = 0, wasToggled = false;
|
|
31589
31616
|
const resize = ()=>{
|
|
31590
31617
|
const { container, events } = editor;
|
|
31591
31618
|
if (!events) {
|
|
@@ -31634,12 +31661,22 @@ const fullsizeStack = new Set();
|
|
|
31634
31661
|
enable ? fullsizeStack.add(container) : fullsizeStack.delete(container);
|
|
31635
31662
|
const shouldToggleGlobalFullsize = editor.o.globalFullSize && (fullsizeStack.size === 1 && enable || fullsizeStack.size === 0 && !enable);
|
|
31636
31663
|
if (shouldToggleGlobalFullsize) {
|
|
31664
|
+
// Entering fullsize sets `position: fixed` on <html>, which
|
|
31665
|
+
// makes the browser reset the page scroll to the top. Remember
|
|
31666
|
+
// the scroll position so it can be restored on exit (#1255).
|
|
31667
|
+
if (enable) {
|
|
31668
|
+
savedScrollLeft = editor.ow.scrollX;
|
|
31669
|
+
savedScrollTop = editor.ow.scrollY;
|
|
31670
|
+
}
|
|
31637
31671
|
let node = container.parentNode;
|
|
31638
31672
|
while(node && node.nodeType !== Node.DOCUMENT_NODE && node.nodeType !== Node.DOCUMENT_FRAGMENT_NODE){
|
|
31639
31673
|
node.classList.toggle('jodit_fullsize-box_true', enable);
|
|
31640
31674
|
node = node.parentNode;
|
|
31641
31675
|
}
|
|
31642
31676
|
resize();
|
|
31677
|
+
if (!enable) {
|
|
31678
|
+
editor.ow.scrollTo(savedScrollLeft, savedScrollTop);
|
|
31679
|
+
}
|
|
31643
31680
|
}
|
|
31644
31681
|
events.fire('afterResize');
|
|
31645
31682
|
};
|
|
@@ -35842,6 +35879,7 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.link = {
|
|
|
35842
35879
|
followOnDblClick: false,
|
|
35843
35880
|
processVideoLink: true,
|
|
35844
35881
|
processPastedLink: true,
|
|
35882
|
+
deriveUrlFromText: false,
|
|
35845
35883
|
noFollowCheckbox: true,
|
|
35846
35884
|
openInNewTabCheckbox: true,
|
|
35847
35885
|
openInNewTabCheckboxDefaultChecked: false,
|
|
@@ -36043,6 +36081,9 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
36043
36081
|
insert.textContent = i18n('Update');
|
|
36044
36082
|
} else {
|
|
36045
36083
|
jodit_core_dom__WEBPACK_IMPORTED_MODULE_3__.Dom.hide(unlink);
|
|
36084
|
+
if (jodit.o.link.deriveUrlFromText && url_input && !isImageContent && !url_input.value.trim()) {
|
|
36085
|
+
url_input.value = guessUrlFromText(content_input.value);
|
|
36086
|
+
}
|
|
36046
36087
|
if (openInNewTabCheckbox && target_checkbox) {
|
|
36047
36088
|
target_checkbox.checked = openInNewTabCheckboxDefaultChecked;
|
|
36048
36089
|
}
|
|
@@ -36169,6 +36210,29 @@ jodit_config__WEBPACK_IMPORTED_MODULE_2__.Config.prototype.controls.link = {
|
|
|
36169
36210
|
jodit_core_decorators__WEBPACK_IMPORTED_MODULE_2__.autobind
|
|
36170
36211
|
], link.prototype, "__onClickReadOnlyLink", null);
|
|
36171
36212
|
jodit_core_global__WEBPACK_IMPORTED_MODULE_4__.pluginSystem.add('link', link);
|
|
36213
|
+
/**
|
|
36214
|
+
* Guess a usable `href` from the selected text for the link dialog.
|
|
36215
|
+
* Returns an empty string when the text is not a plausible URL/email,
|
|
36216
|
+
* so plain text (e.g. "click here") is left untouched.
|
|
36217
|
+
*/ function guessUrlFromText(text) {
|
|
36218
|
+
const value = text.trim();
|
|
36219
|
+
if (!value || /\s/.test(value)) {
|
|
36220
|
+
return '';
|
|
36221
|
+
}
|
|
36222
|
+
// already an explicit scheme, an anchor or a relative path
|
|
36223
|
+
if (/^(https?:|mailto:|tel:|ftp:|#|\/|\.{1,2}\/)/i.test(value)) {
|
|
36224
|
+
return value;
|
|
36225
|
+
}
|
|
36226
|
+
// email address -> mailto:
|
|
36227
|
+
if (/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value)) {
|
|
36228
|
+
return `mailto:${value}`;
|
|
36229
|
+
}
|
|
36230
|
+
// bare domain like example.com or www.example.com/path -> https://
|
|
36231
|
+
if (/^[a-z0-9-]+(\.[a-z0-9-]+)+(\/\S*)?$/i.test(value)) {
|
|
36232
|
+
return `https://${value}`;
|
|
36233
|
+
}
|
|
36234
|
+
return '';
|
|
36235
|
+
}
|
|
36172
36236
|
function writeClasses(modeClassName, className_input, className_select, a) {
|
|
36173
36237
|
if (modeClassName && (className_input !== null && className_input !== void 0 ? className_input : className_select)) {
|
|
36174
36238
|
if (modeClassName === 'input') {
|