inital commit

This commit is contained in:
2026-01-01 15:25:19 +05:30
commit f0ae49465a
36361 changed files with 4894111 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* Always return Array
* ```javascript
* Jodit.modules.Helpers.asArray('test') // ['test']
* Jodit.modules.Helpers.asArray(['test']) // ['test']
* Jodit.modules.Helpers.asArray(1) // [1]
* ```
*/
export declare const asArray: <T>(a: T[] | T) => T[];

18
node_modules/jodit/esm/core/helpers/array/as-array.js generated vendored Normal file
View File

@@ -0,0 +1,18 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module helpers/array
*/
import { isArray } from "../checker/is-array.js";
/**
* Always return Array
* ```javascript
* Jodit.modules.Helpers.asArray('test') // ['test']
* Jodit.modules.Helpers.asArray(['test']) // ['test']
* Jodit.modules.Helpers.asArray(1) // [1]
* ```
*/
export const asArray = (a) => (isArray(a) ? a : [a]);

11
node_modules/jodit/esm/core/helpers/array/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,11 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module helpers/array
*/
export { asArray } from "./as-array";
export { splitArray } from "./split-array";
export { toArray } from "./to-array";

11
node_modules/jodit/esm/core/helpers/array/index.js generated vendored Normal file
View File

@@ -0,0 +1,11 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module helpers/array
*/
export { asArray } from "./as-array.js";
export { splitArray } from "./split-array.js";
export { toArray } from "./to-array.js";

View File

@@ -0,0 +1,11 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module helpers/array
*/
export declare function splitArray(a: string): string[];
export declare function splitArray<T extends any[]>(a: T): T;
export declare function splitArray<T extends any[]>(a: T | string): T | string[];

View File

@@ -0,0 +1,15 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* Return an array from string or array
* ```javascript
* Jodit.modules.Helpers.splitArray('1,2,3') // ['1', '2', '3']
* Jodit.modules.Helpers.splitArray(['1', '2', '3']) // ['1', '2', '3']
* ```
*/
export function splitArray(a) {
return Array.isArray(a) ? a : a.split(/[,\s]+/);
}

View File

@@ -0,0 +1,15 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* Always return Array. It's a safe polyfill for [Array.from](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/from) method
* In certain scenarios (such as with Joomla Mootools), Array.from may be substituted with a less optimal implementation
* ```javascript
* Jodit.modules.Helpers.toArray('123') // ['1', '2', '3']
* Jodit.modules.Helpers.toArray(['test']) // ['test']
* Jodit.modules.Helpers.toArray(1) // []
* ```
*/
export declare const toArray: typeof Array.from;

26
node_modules/jodit/esm/core/helpers/array/to-array.js generated vendored Normal file
View File

@@ -0,0 +1,26 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module helpers/array
*/
import { isNativeFunction } from "../checker/is-native-function.js";
import { reset } from "../utils/reset.js";
/**
* Always return Array. It's a safe polyfill for [Array.from](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/from) method
* In certain scenarios (such as with Joomla Mootools), Array.from may be substituted with a less optimal implementation
* ```javascript
* Jodit.modules.Helpers.toArray('123') // ['1', '2', '3']
* Jodit.modules.Helpers.toArray(['test']) // ['test']
* Jodit.modules.Helpers.toArray(1) // []
* ```
*/
export const toArray = function toArray(...args) {
var _a;
const func = isNativeFunction(Array.from)
? Array.from
: ((_a = reset('Array.from')) !== null && _a !== void 0 ? _a : Array.from);
return func.apply(Array, args);
};

9
node_modules/jodit/esm/core/helpers/async/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,9 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module helpers/async
*/
export * from "./set-timeout";

9
node_modules/jodit/esm/core/helpers/async/index.js generated vendored Normal file
View File

@@ -0,0 +1,9 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module helpers/async
*/
export * from "./set-timeout.js";

View File

@@ -0,0 +1,13 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* Create async callback if set timeout value - else call function immediately
*/
export declare function setTimeout<T = any>(callback: (...args: T[]) => void, timeout: number, ...args: T[]): number;
/**
* Clear timeout
*/
export declare function clearTimeout(timer: number): void;

View File

@@ -0,0 +1,27 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module helpers/async
*/
import { globalWindow } from "../../constants.js";
/**
* Create async callback if set timeout value - else call function immediately
*/
export function setTimeout(callback, timeout, ...args) {
if (!timeout) {
callback.call(null, ...args);
}
else {
return globalWindow.setTimeout(callback, timeout, ...args);
}
return 0;
}
/**
* Clear timeout
*/
export function clearTimeout(timer) {
globalWindow.clearTimeout(timer);
}

View File

@@ -0,0 +1,9 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* Check if browser has a color picker (a new HTML5 attribute for input tag)
*/
export declare function hasBrowserColorPicker(): boolean;

View File

@@ -0,0 +1,25 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module helpers/checker
*/
import { globalDocument } from "../../constants.js";
/**
* Check if browser has a color picker (a new HTML5 attribute for input tag)
*/
export function hasBrowserColorPicker() {
let supportsColor = true;
try {
const a = globalDocument.createElement('input');
a.type = 'color';
a.value = '!';
supportsColor = a.type === 'color' && a.value !== '!';
}
catch (e) {
supportsColor = false;
}
return supportsColor;
}

33
node_modules/jodit/esm/core/helpers/checker/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,33 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module helpers/checker
*/
export * from "./has-browser-color-picker";
export * from "./is-abort-error";
export * from "./is-array";
export * from "./is-boolean";
export * from "./is-equal";
export * from "./is-function";
export * from "./is-html";
export * from "./is-html-from-word";
export * from "./is-imp-interface";
export * from "./is-int";
export * from "./is-jodit-object";
export * from "./is-license";
export * from "./is-marker";
export * from "./is-native-function";
export * from "./is-number";
export * from "./is-numeric";
export * from "./is-plain-object";
export * from "./is-promise";
export * from "./is-set";
export * from "./is-string";
export * from "./is-url";
export * from "./is-valid-name";
export * from "./is-view-object";
export * from "./is-void";
export * from "./is-window";

33
node_modules/jodit/esm/core/helpers/checker/index.js generated vendored Normal file
View File

@@ -0,0 +1,33 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module helpers/checker
*/
export * from "./has-browser-color-picker.js";
export * from "./is-abort-error.js";
export * from "./is-array.js";
export * from "./is-boolean.js";
export * from "./is-equal.js";
export * from "./is-function.js";
export * from "./is-html.js";
export * from "./is-html-from-word.js";
export * from "./is-imp-interface.js";
export * from "./is-int.js";
export * from "./is-jodit-object.js";
export * from "./is-license.js";
export * from "./is-marker.js";
export * from "./is-native-function.js";
export * from "./is-number.js";
export * from "./is-numeric.js";
export * from "./is-plain-object.js";
export * from "./is-promise.js";
export * from "./is-set.js";
export * from "./is-string.js";
export * from "./is-url.js";
export * from "./is-valid-name.js";
export * from "./is-view-object.js";
export * from "./is-void.js";
export * from "./is-window.js";

View File

@@ -0,0 +1,10 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module helpers/checker
*/
import type { AbortError } from "../utils/error/errors/abort-error";
export declare function isAbortError(error: unknown): error is AbortError;

View File

@@ -0,0 +1,10 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
export function isAbortError(error) {
return (Boolean(error) &&
error instanceof DOMException &&
error.name === 'AbortError');
}

View File

@@ -0,0 +1,12 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module helpers/checker
*/
/**
* Check if element is array
*/
export declare function isArray<T = any>(elm: unknown): elm is T[];

View File

@@ -0,0 +1,14 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module helpers/checker
*/
/**
* Check if element is array
*/
export function isArray(elm) {
return Array.isArray(elm);
}

View File

@@ -0,0 +1,9 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module helpers/checker
*/
export declare function isBoolean(elm: unknown): elm is boolean;

View File

@@ -0,0 +1,11 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module helpers/checker
*/
export function isBoolean(elm) {
return typeof elm === 'boolean';
}

View File

@@ -0,0 +1,10 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* Check two element are equal
*/
export declare function isEqual(a: unknown, b: unknown): boolean;
export declare function isFastEqual(a: unknown, b: unknown): boolean;

View File

@@ -0,0 +1,18 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module helpers/checker
*/
import { stringify } from "../string/stringify.js";
/**
* Check two element are equal
*/
export function isEqual(a, b) {
return a === b || stringify(a) === stringify(b);
}
export function isFastEqual(a, b) {
return a === b;
}

View File

@@ -0,0 +1,12 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module helpers/checker
*/
/**
* Check value is Function
*/
export declare function isFunction(value: unknown): value is Function;

View File

@@ -0,0 +1,14 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module helpers/checker
*/
/**
* Check value is Function
*/
export function isFunction(value) {
return typeof value === 'function';
}

View File

@@ -0,0 +1,12 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module helpers/checker
*/
/**
* Detect if string is HTML from MS Word or Excel
*/
export declare function isHtmlFromWord(data: string): boolean;

View File

@@ -0,0 +1,16 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module helpers/checker
*/
/**
* Detect if string is HTML from MS Word or Excel
*/
export function isHtmlFromWord(data) {
return (data.search(/<meta.*?Microsoft Excel\s[\d].*?>/) !== -1 ||
data.search(/<meta.*?Microsoft Word\s[\d].*?>/) !== -1 ||
(data.search(/style="[^"]*mso-/) !== -1 && data.search(/<font/) !== -1));
}

View File

@@ -0,0 +1,9 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* Check if a string is html or not
*/
export declare const isHTML: (str: unknown) => str is string;

14
node_modules/jodit/esm/core/helpers/checker/is-html.js generated vendored Normal file
View File

@@ -0,0 +1,14 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module helpers/checker
*/
import { isString } from "./is-string.js";
/**
* Check if a string is html or not
*/
export const isHTML = (str) => isString(str) &&
/<([A-Za-z][A-Za-z0-9]*)\b[^>]*>(.*?)<\/\1>/m.test(str.replace(/[\r\n]/g, ''));

View File

@@ -0,0 +1,21 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module helpers/checker
*/
import type { IContainer, IDestructible, IInitable } from "../../../types/index";
/**
* Check value has method init
*/
export declare function isInitable(value: unknown): value is IInitable;
/**
* Check value has method destruct
*/
export declare function isDestructable(value: unknown): value is IDestructible;
/**
* Check value is instant that implements IContainer
*/
export declare function hasContainer(value: unknown): value is IContainer;

View File

@@ -0,0 +1,26 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
import { Dom } from "../../dom/dom.js";
import { isFunction } from "./is-function.js";
import { isVoid } from "./is-void.js";
/**
* Check value has method init
*/
export function isInitable(value) {
return !isVoid(value) && isFunction(value.init);
}
/**
* Check value has method destruct
*/
export function isDestructable(value) {
return !isVoid(value) && isFunction(value.destruct);
}
/**
* Check value is instant that implements IContainer
*/
export function hasContainer(value) {
return !isVoid(value) && Dom.isElement(value.container);
}

View File

@@ -0,0 +1,9 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* Check value is Int
*/
export declare function isInt(value: number | string): boolean;

19
node_modules/jodit/esm/core/helpers/checker/is-int.js generated vendored Normal file
View File

@@ -0,0 +1,19 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module helpers/checker
*/
import { isNumeric } from "./is-numeric.js";
import { isString } from "./is-string.js";
/**
* Check value is Int
*/
export function isInt(value) {
if (isString(value) && isNumeric(value)) {
value = parseFloat(value);
}
return typeof value === 'number' && Number.isFinite(value) && !(value % 1);
}

View File

@@ -0,0 +1,13 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module helpers/checker
*/
import type { IJodit } from "../../../types/index";
/**
* Check if element is instance of Jodit
*/
export declare function isJoditObject(jodit: unknown): jodit is IJodit;

View File

@@ -0,0 +1,17 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
import { isFunction } from "./is-function.js";
/**
* Check if element is instance of Jodit
*/
export function isJoditObject(jodit) {
return Boolean(jodit &&
jodit instanceof Object &&
isFunction(jodit.constructor) &&
// @ts-ignore
((typeof Jodit !== 'undefined' && jodit instanceof Jodit) ||
jodit.isJodit));
}

View File

@@ -0,0 +1,6 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
export declare const isLicense: (license: string) => boolean;

View File

@@ -0,0 +1,12 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module helpers/checker
*/
import { isString } from "./is-string.js";
export const isLicense = (license) => isString(license) &&
license.length === 23 &&
/^[a-z0-9]{5}-[a-z0-9]{5}-[a-z0-9]{5}-[a-z0-9]{5}$/i.test(license);

View File

@@ -0,0 +1,13 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module helpers/checker
*/
import type { Nullable } from "../../../types/index";
/**
* Define element is selection helper
*/
export declare function isMarker(elm: Nullable<Node>): elm is HTMLElement;

View File

@@ -0,0 +1,15 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
import { MARKER_CLASS } from "../../constants.js";
import { Dom } from "../../dom/dom.js";
/**
* Define element is selection helper
*/
export function isMarker(elm) {
return (Dom.isNode(elm) &&
Dom.isTag(elm, 'span') &&
elm.hasAttribute('data-' + MARKER_CLASS));
}

View File

@@ -0,0 +1,12 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module helpers/checker
*/
/**
* Check if function or method was not replaced on some custom implementation
*/
export declare function isNativeFunction(f: Function): boolean;

View File

@@ -0,0 +1,17 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module helpers/checker
*/
/**
* Check if function or method was not replaced on some custom implementation
*/
export function isNativeFunction(f) {
return (Boolean(f) &&
(typeof f).toLowerCase() === 'function' &&
(f === Function.prototype ||
/^\s*function\s*(\b[a-z$_][a-z0-9$_]*\b)*\s*\((|([a-z$_][a-z0-9$_]*)(\s*,[a-z$_][a-z0-9$_]*)*)\)\s*{\s*\[native code]\s*}\s*$/i.test(String(f))));
}

View File

@@ -0,0 +1,12 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module helpers/checker
*/
/**
* Check value is a number
*/
export declare function isNumber(value: unknown): value is number;

View File

@@ -0,0 +1,14 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module helpers/checker
*/
/**
* Check value is a number
*/
export function isNumber(value) {
return typeof value === 'number' && !isNaN(value) && isFinite(value);
}

View File

@@ -0,0 +1,9 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* Check value has numeric format
*/
export declare function isNumeric(value: number | string): boolean;

View File

@@ -0,0 +1,21 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module helpers/checker
*/
import { isString } from "./is-string.js";
/**
* Check value has numeric format
*/
export function isNumeric(value) {
if (isString(value)) {
if (!value.match(/^([+-])?[0-9]+(\.?)([0-9]+)?(e[0-9]+)?$/)) {
return false;
}
value = parseFloat(value);
}
return typeof value === 'number' && !isNaN(value) && isFinite(value);
}

View File

@@ -0,0 +1,13 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module helpers/checker
*/
import type { IDictionary } from "../../../types/index";
/**
* Check if element is simple plaint object
*/
export declare function isPlainObject<T>(obj: any | IDictionary<T>): obj is IDictionary<T>;

View File

@@ -0,0 +1,16 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
import { isWindow } from "./is-window.js";
/**
* Check if element is simple plaint object
*/
export function isPlainObject(obj) {
if (!obj || typeof obj !== 'object' || obj.nodeType || isWindow(obj)) {
return false;
}
return !(obj.constructor &&
!{}.hasOwnProperty.call(obj.constructor.prototype, 'isPrototypeOf'));
}

View File

@@ -0,0 +1,9 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module helpers/checker
*/
export declare function isPromise(val: any | Promise<any>): val is Promise<any>;

View File

@@ -0,0 +1,11 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module helpers/checker
*/
export function isPromise(val) {
return val && typeof val.then === 'function';
}

View File

@@ -0,0 +1,9 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* Check if element is set
*/
export declare function isSet<T = any>(elm: unknown): elm is Set<T>;

18
node_modules/jodit/esm/core/helpers/checker/is-set.js generated vendored Normal file
View File

@@ -0,0 +1,18 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module helpers/checker
*/
import { isFunction } from "./is-function.js";
/**
* Check if element is set
*/
export function isSet(elm) {
return (Boolean(elm) &&
isFunction(elm.has) &&
isFunction(elm.add) &&
isFunction(elm.delete));
}

View File

@@ -0,0 +1,13 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* Check value is String
*/
export declare function isString(value: unknown): value is string;
/**
* Check value is Array of String
*/
export declare function isStringArray(value: unknown): value is string[];

View File

@@ -0,0 +1,21 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module helpers/checker
*/
import { isArray } from "./is-array.js";
/**
* Check value is String
*/
export function isString(value) {
return typeof value === 'string';
}
/**
* Check value is Array of String
*/
export function isStringArray(value) {
return isArray(value) && isString(value[0]);
}

View File

@@ -0,0 +1,9 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* Check if a string is an url
*/
export declare function isURL(str: string): boolean;

29
node_modules/jodit/esm/core/helpers/checker/is-url.js generated vendored Normal file
View File

@@ -0,0 +1,29 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module helpers/checker
*/
import { globalDocument } from "../../constants.js";
/**
* Check if a string is an url
*/
export function isURL(str) {
if (str.includes(' ')) {
return false;
}
if (typeof URL !== 'undefined') {
try {
const url = new URL(str);
return ['https:', 'http:', 'ftp:', 'file:', 'rtmp:'].includes(url.protocol);
}
catch (e) {
return false;
}
}
const a = globalDocument.createElement('a');
a.href = str;
return Boolean(a.hostname);
}

View File

@@ -0,0 +1,12 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module helpers/checker
*/
/**
* Check if name has a normal format
*/
export declare function isValidName(name: string): boolean;

View File

@@ -0,0 +1,17 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module helpers/checker
*/
/**
* Check if name has a normal format
*/
export function isValidName(name) {
if (!name.length) {
return false;
}
return !/[^0-9A-Za-zа-яА-ЯЁё\w\-_. ]/.test(name) && name.trim().length > 0;
}

View File

@@ -0,0 +1,13 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module helpers/checker
*/
import type { IViewBased } from "../../../types/index";
/**
* Check if an element is instance of View
*/
export declare function isViewObject(jodit: unknown): jodit is IViewBased;

View File

@@ -0,0 +1,15 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
import { isFunction } from "./is-function.js";
/**
* Check if an element is instance of View
*/
export function isViewObject(jodit) {
return Boolean(jodit &&
jodit instanceof Object &&
isFunction(jodit.constructor) &&
jodit.isView);
}

View File

@@ -0,0 +1,12 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module helpers/checker
*/
/**
* Check value is undefined or null
*/
export declare function isVoid(value: unknown): value is undefined | null;

15
node_modules/jodit/esm/core/helpers/checker/is-void.js generated vendored Normal file
View File

@@ -0,0 +1,15 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module helpers/checker
*/
/**
* Check value is undefined or null
*/
export function isVoid(value) {
// eslint-disable-next-line eqeqeq
return value === undefined || value === null;
}

View File

@@ -0,0 +1,9 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module helpers/checker
*/
export declare function isWindow(obj: object): boolean;

View File

@@ -0,0 +1,11 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module helpers/checker
*/
export function isWindow(obj) {
return obj != null && obj === obj.window;
}

View File

@@ -0,0 +1,22 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module helpers/color
*/
/**
* Converts rgba text representation of color in hex
*
* @param color - string like rgba(red, green, blue, alpha) or rgb(red, green, blue)
* @returns hex color view, NaN - for transparent color
* @example
* ```javascript
* var p = document.createElement('p');
* p.style.color = '#ffffff';
* console.log(p.getAttribute('style')); // color: rgb(255, 255, 255);
* console.log(colorTohex(p.style.color)); // #ffffff
* ```
*/
export declare const colorToHex: (color: string) => string | false;

View File

@@ -0,0 +1,43 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module helpers/color
*/
/**
* Converts rgba text representation of color in hex
*
* @param color - string like rgba(red, green, blue, alpha) or rgb(red, green, blue)
* @returns hex color view, NaN - for transparent color
* @example
* ```javascript
* var p = document.createElement('p');
* p.style.color = '#ffffff';
* console.log(p.getAttribute('style')); // color: rgb(255, 255, 255);
* console.log(colorTohex(p.style.color)); // #ffffff
* ```
*/
export const colorToHex = (color) => {
if (color === 'rgba(0, 0, 0, 0)' || color === '') {
return false;
}
if (!color) {
return '#000000';
}
if (color.substr(0, 1) === '#') {
return color;
}
const digits = /([\s\n\t\r]*?)rgb\((\d+), (\d+), (\d+)\)/.exec(color) ||
/([\s\n\t\r]*?)rgba\((\d+), (\d+), (\d+), ([\d.]+)\)/.exec(color);
if (!digits) {
return '#000000';
}
const red = parseInt(digits[2], 10), green = parseInt(digits[3], 10), blue = parseInt(digits[4], 10), rgb = blue | (green << 8) | (red << 16);
let hex = rgb.toString(16).toUpperCase();
while (hex.length < 6) {
hex = '0' + hex;
}
return digits[1] + '#' + hex;
};

9
node_modules/jodit/esm/core/helpers/color/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,9 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module helpers/color
*/
export * from "./color-to-hex";

9
node_modules/jodit/esm/core/helpers/color/index.js generated vendored Normal file
View File

@@ -0,0 +1,9 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module helpers/color
*/
export * from "./color-to-hex.js";

View File

@@ -0,0 +1,11 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* If the HTML has CSS rules with selectors,
* it applies them to the selectors in the HTML itself
* and then removes the selector styles, leaving only the inline ones.
*/
export declare function applyStyles(html: string): string;

View File

@@ -0,0 +1,100 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module helpers/html
*/
import { globalDocument, IS_PROD } from "../../constants.js";
import { Dom } from "../../dom/dom.js";
import { trim } from "../string/trim.js";
import { $$ } from "../utils/selector.js";
function normalizeCSS(s) {
return s
.replace(/mso-[a-z-]+:[\s]*[^;]+;/gi, '')
.replace(/mso-[a-z-]+:[\s]*[^";']+$/gi, '')
.replace(/border[a-z-]*:[\s]*[^;]+;/gi, '')
.replace(/([0-9.]+)(pt|cm)/gi, (match, units, metrics) => {
switch (metrics.toLowerCase()) {
case 'pt':
return (parseFloat(units) * 1.328).toFixed(0) + 'px';
case 'cm':
return (parseFloat(units) * 0.02645833).toFixed(0) + 'px';
}
return match;
});
}
/**
* If the HTML has CSS rules with selectors,
* it applies them to the selectors in the HTML itself
* and then removes the selector styles, leaving only the inline ones.
*/
export function applyStyles(html) {
if (html.indexOf('<html ') === -1) {
return html;
}
html = html.substring(html.indexOf('<html '), html.length);
html = html.substring(0, html.lastIndexOf('</html>') + '</html>'.length);
const iframe = globalDocument.createElement('iframe');
iframe.style.display = 'none';
globalDocument.body.appendChild(iframe);
let convertedString = '', collection = [];
try {
const iframeDoc = iframe.contentDocument ||
(iframe.contentWindow ? iframe.contentWindow.document : null);
if (iframeDoc) {
iframeDoc.open();
iframeDoc.write(html);
iframeDoc.close();
try {
for (let i = 0; i < iframeDoc.styleSheets.length; i += 1) {
const rules = iframeDoc.styleSheets[i].cssRules;
for (let idx = 0; idx < rules.length; idx += 1) {
if (rules[idx].selectorText === '') {
continue;
}
collection = $$(rules[idx].selectorText, iframeDoc.body);
collection.forEach((elm) => {
elm.style.cssText = normalizeCSS(rules[idx].style.cssText +
';' +
elm.style.cssText);
});
}
}
}
catch (e) {
if (!IS_PROD) {
throw e;
}
}
Dom.each(iframeDoc.body, node => {
if (Dom.isElement(node)) {
const elm = node;
const css = elm.getAttribute('style');
if (css) {
elm.style.cssText = normalizeCSS(css);
}
if (elm.hasAttribute('style') &&
!elm.getAttribute('style')) {
elm.removeAttribute('style');
}
}
});
convertedString = iframeDoc.firstChild
? trim(iframeDoc.body.innerHTML)
: '';
}
}
catch (_a) {
}
finally {
Dom.safeRemove(iframe);
}
if (convertedString) {
html = convertedString;
}
return trim(html
.replace(/<(\/)?(html|colgroup|col|o:p)[^>]*>/g, '')
.replace(/<!--[^>]*>/g, ''));
}

View File

@@ -0,0 +1,10 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* The method automatically cleans up content from Microsoft Word and other HTML sources to ensure clean, compliant
* content that matches the look and feel of the site.
*/
export declare function cleanFromWord(html: string): string;

View File

@@ -0,0 +1,76 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module helpers/html
*/
import { globalDocument } from "../../constants.js";
import { Dom } from "../../dom/dom.js";
import { toArray } from "../array/to-array.js";
import { trim } from "../string/trim.js";
/**
* The method automatically cleans up content from Microsoft Word and other HTML sources to ensure clean, compliant
* content that matches the look and feel of the site.
*/
export function cleanFromWord(html) {
if (html.indexOf('<html ') !== -1) {
html = html.substring(html.indexOf('<html '), html.length);
html = html.substring(0, html.lastIndexOf('</html>') + '</html>'.length);
}
let convertedString = '';
try {
const div = globalDocument.createElement('div');
div.innerHTML = html;
const marks = [];
if (div.firstChild) {
Dom.each(div, node => {
if (!node) {
return;
}
switch (node.nodeType) {
case Node.ELEMENT_NODE:
switch (node.nodeName) {
case 'STYLE':
case 'LINK':
case 'META':
marks.push(node);
break;
case 'W:SDT':
case 'W:SDTPR':
case 'FONT':
Dom.unwrap(node);
break;
default:
toArray(node.attributes).forEach((attr) => {
if ([
'src',
'href',
'rel',
'content'
].indexOf(attr.name.toLowerCase()) === -1) {
node.removeAttribute(attr.name);
}
});
}
break;
case Node.TEXT_NODE:
break;
default:
marks.push(node);
}
});
}
Dom.safeRemove.apply(null, marks);
convertedString = div.innerHTML;
}
catch (e) { }
if (convertedString) {
html = convertedString;
}
html = html.split(/(\n)/).filter(trim).join('\n');
return html
.replace(/<(\/)?(html|colgroup|col|o:p)[^>]*>/g, '')
.replace(/<!--[^>]*>/g, '');
}

View File

@@ -0,0 +1,9 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* Convert special characters to HTML entities
*/
export declare function htmlspecialchars(html: string): string;

View File

@@ -0,0 +1,17 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module helpers/html
*/
import { globalDocument } from "../../constants.js";
/**
* Convert special characters to HTML entities
*/
export function htmlspecialchars(html) {
const tmp = globalDocument.createElement('div');
tmp.textContent = html;
return tmp.innerHTML;
}

14
node_modules/jodit/esm/core/helpers/html/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,14 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module helpers/html
*/
export * from "./apply-styles";
export * from "./clean-from-word";
export * from "./htmlspecialchars";
export * from "./nl2br";
export * from "./safe-html";
export * from "./strip-tags";

14
node_modules/jodit/esm/core/helpers/html/index.js generated vendored Normal file
View File

@@ -0,0 +1,14 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module helpers/html
*/
export * from "./apply-styles.js";
export * from "./clean-from-word.js";
export * from "./htmlspecialchars.js";
export * from "./nl2br.js";
export * from "./safe-html.js";
export * from "./strip-tags.js";

12
node_modules/jodit/esm/core/helpers/html/nl2br.d.ts generated vendored Normal file
View File

@@ -0,0 +1,12 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module helpers/html
*/
/**
* Inserts HTML line breaks before all newlines in a string
*/
export declare function nl2br(html: string): string;

14
node_modules/jodit/esm/core/helpers/html/nl2br.js generated vendored Normal file
View File

@@ -0,0 +1,14 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module helpers/html
*/
/**
* Inserts HTML line breaks before all newlines in a string
*/
export function nl2br(html) {
return html.replace(/\r\n|\r|\n/g, '<br/>');
}

View File

@@ -0,0 +1,15 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
type safeOptions = {
removeOnError: boolean;
safeJavaScriptLink: boolean;
};
/**
* Removes dangerous constructs from HTML
*/
export declare function safeHTML(box: HTMLElement | DocumentFragment, options: safeOptions): void;
export declare function sanitizeHTMLElement(elm: Element | DocumentFragment, { safeJavaScriptLink, removeOnError }?: safeOptions): boolean;
export {};

45
node_modules/jodit/esm/core/helpers/html/safe-html.js generated vendored Normal file
View File

@@ -0,0 +1,45 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module helpers/html
*/
import { Dom } from "../../dom/dom.js";
import { $$, attr } from "../utils/index.js";
/**
* Removes dangerous constructs from HTML
*/
export function safeHTML(box, options) {
if (!Dom.isElement(box) && !Dom.isFragment(box)) {
return;
}
if (options.removeOnError) {
sanitizeHTMLElement(box);
$$('[onerror]', box).forEach(elm => sanitizeHTMLElement(elm, options));
}
if (options.safeJavaScriptLink) {
sanitizeHTMLElement(box);
$$('a[href^="javascript"]', box).forEach(elm => sanitizeHTMLElement(elm, options));
}
}
export function sanitizeHTMLElement(elm, { safeJavaScriptLink, removeOnError } = {
safeJavaScriptLink: true,
removeOnError: true
}) {
if (!Dom.isElement(elm)) {
return false;
}
let effected = false;
if (removeOnError && elm.hasAttribute('onerror')) {
attr(elm, 'onerror', null);
effected = true;
}
const href = elm.getAttribute('href');
if (safeJavaScriptLink && href && href.trim().indexOf('javascript') === 0) {
attr(elm, 'href', location.protocol + '//' + href);
effected = true;
}
return effected;
}

View File

@@ -0,0 +1,13 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module helpers/html
*/
import type { HTMLTagNames, Nullable } from "../../../types/index";
/**
* Extract plain text from HTML text
*/
export declare function stripTags(html: string | Node, doc?: Document, exclude?: Nullable<Set<HTMLTagNames>>): string;

68
node_modules/jodit/esm/core/helpers/html/strip-tags.js generated vendored Normal file
View File

@@ -0,0 +1,68 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
import { Dom } from "../../dom/dom.js";
import { isString } from "../checker/is-string.js";
import { trim } from "../string/trim.js";
import { $$ } from "../utils/index.js";
const NEW_LINE_TAGS = new Set([
'div',
'p',
'br',
'h1',
'h2',
'h3',
'h4',
'h5',
'h6',
'hr'
]);
const INVISIBLE_TAGS = new Set(['script', 'style']);
const ALONE_TAGS = new Set(['br', 'hr', 'input']);
/**
* Extract plain text from HTML text
*/
export function stripTags(html, doc = document, exclude = null) {
const tmp = doc.createElement('div');
if (isString(html)) {
tmp.innerHTML = html;
}
else {
tmp.appendChild(html);
}
$$('*', tmp).forEach(p => {
const pr = p.parentNode;
if (!pr) {
return;
}
if (exclude && Dom.isTag(p, exclude)) {
const tag = p.nodeName.toLowerCase();
const text = !Dom.isTag(p, ALONE_TAGS)
? `%%%jodit-${tag}%%%${stripTags(p.innerHTML, doc, exclude)}%%%/jodit-${tag}%%%`
: `%%%jodit-single-${tag}%%%`;
Dom.before(p, doc.createTextNode(text));
Dom.safeRemove(p);
return;
}
if (Dom.isTag(p, INVISIBLE_TAGS)) {
Dom.safeRemove(p);
return;
}
if (!Dom.isTag(p, NEW_LINE_TAGS)) {
return;
}
const nx = p.nextSibling;
if (Dom.isText(nx) && /^\s/.test(nx.nodeValue || '')) {
return;
}
if (nx) {
pr.insertBefore(doc.createTextNode(' '), nx);
}
});
return restoreTags(trim(tmp.innerText));
}
function restoreTags(content) {
return content.replace(/%%%(\/)?jodit(-single)?-([\w\n]+)%%%/g, (_, isClosed, isSingle, tag) => `<${isClosed ? '/' : ''}${tag}>`);
}

19
node_modules/jodit/esm/core/helpers/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,19 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* [[include:core/helpers/README.md]]
* @packageDocumentation
* @module helpers
*/
export * from "./array/index";
export * from "./async/index";
export * from "./checker/index";
export * from "./color/index";
export * from "./html/index";
export * from "./normalize/index";
export * from "./size/index";
export * from "./string/index";
export * from "./utils/index";

19
node_modules/jodit/esm/core/helpers/index.js generated vendored Normal file
View File

@@ -0,0 +1,19 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* [[include:core/helpers/README.md]]
* @packageDocumentation
* @module helpers
*/
export * from "./array/index.js";
export * from "./async/index.js";
export * from "./checker/index.js";
export * from "./color/index.js";
export * from "./html/index.js";
export * from "./normalize/index.js";
export * from "./size/index.js";
export * from "./string/index.js";
export * from "./utils/index.js";

View File

@@ -0,0 +1,16 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module helpers/normalize
*/
export * from "./normalize-color";
export * from "./normalize-css-value";
export * from "./normalize-key-aliases";
export * from "./normalize-license";
export * from "./normalize-path";
export * from "./normalize-relative-path";
export * from "./normalize-size";
export * from "./normalize-url";

16
node_modules/jodit/esm/core/helpers/normalize/index.js generated vendored Normal file
View File

@@ -0,0 +1,16 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module helpers/normalize
*/
export * from "./normalize-color.js";
export * from "./normalize-css-value.js";
export * from "./normalize-key-aliases.js";
export * from "./normalize-license.js";
export * from "./normalize-path.js";
export * from "./normalize-relative-path.js";
export * from "./normalize-size.js";
export * from "./normalize-url.js";

View File

@@ -0,0 +1,12 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* Convert rgba and short HEX color to Full text color. #fff to #FFFFFF
*
* @param colorInput - string like rgba(red, green, blue, alpha) or rgb(red, green, blue) or #fff or #ffffff
* @returns HEX color, false - for transparent color
*/
export declare const normalizeColor: (colorInput: string) => string | false;

View File

@@ -0,0 +1,36 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module helpers/normalize
*/
import { colorToHex } from "../color/color-to-hex.js";
import { trim } from "../string/trim.js";
/**
* Convert rgba and short HEX color to Full text color. #fff to #FFFFFF
*
* @param colorInput - string like rgba(red, green, blue, alpha) or rgb(red, green, blue) or #fff or #ffffff
* @returns HEX color, false - for transparent color
*/
export const normalizeColor = (colorInput) => {
const newcolor = ['#'];
let color = colorToHex(colorInput);
if (!color) {
return false;
}
color = trim(color.toUpperCase());
color = color.substring(1);
if (color.length === 3) {
for (let i = 0; i < 3; i += 1) {
newcolor.push(color[i]);
newcolor.push(color[i]);
}
return newcolor.join('');
}
if (color.length > 6) {
color = color.slice(0, 6);
}
return '#' + color;
};

View File

@@ -0,0 +1,8 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
export declare const NUMBER_FIELDS_REG: RegExp;
export declare function normalizeCssNumericValue(key: string, value: string | number | undefined | null): string | number | undefined | null;
export declare function normalizeCssValue(key: string, value: string | number): string | number;

View File

@@ -0,0 +1,42 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module helpers/normalize
*/
import { isNumeric } from "../checker/is-numeric.js";
import { isVoid } from "../checker/is-void.js";
import { colorToHex } from "../color/color-to-hex.js";
import { kebabCase } from "../string/kebab-case.js";
export const NUMBER_FIELDS_REG = /^(left|top|bottom|right|width|min|max|height|margin|padding|fontsize|font-size)/i;
export function normalizeCssNumericValue(key, value) {
if (!isVoid(value) &&
NUMBER_FIELDS_REG.test(key) &&
isNumeric(value.toString())) {
return parseInt(value.toString(), 10) + 'px';
}
return value;
}
export function normalizeCssValue(key, value) {
switch (kebabCase(key)) {
case 'font-weight':
switch (value.toString().toLowerCase()) {
case '700':
case 'bold':
return 700;
case '400':
case 'normal':
return 400;
case '900':
case 'heavy':
return 900;
}
return isNumeric(value) ? Number(value) : value;
}
if (/color/i.test(key) && /^rgb/i.test(value.toString())) {
return colorToHex(value.toString()) || value;
}
return value;
}

View File

@@ -0,0 +1,9 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* Normalize keys to some standard name
*/
export declare function normalizeKeyAliases(keys: string): string;

View File

@@ -0,0 +1,40 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
import { KEY_ALIASES } from "../../constants.js";
import { trim } from "../string/trim.js";
/**
* Normalize keys to some standard name
*/
export function normalizeKeyAliases(keys) {
const memory = {};
const order = {
meta: 1,
ctrl: 2,
control: 2,
alt: 3,
shift: 4,
space: 5
};
return keys
.replace(/\+\+/g, '+add')
.split(/[\s]*\+[\s]*/)
.map(key => trim(key.toLowerCase()))
.map(key => KEY_ALIASES[key] || key)
.sort((a, b) => {
if (order[a] && !order[b]) {
return -1;
}
if (!order[a] && order[b]) {
return 1;
}
if (order[a] && order[b]) {
return order[a] - order[b];
}
return a > b ? 1 : -1;
})
.filter(key => !memory[key] && key !== '' && (memory[key] = true))
.join('+');
}

View File

@@ -0,0 +1,9 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module helpers/normalize
*/
export declare const normalizeLicense: (license: string, count?: number) => string;

View File

@@ -0,0 +1,18 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module helpers/normalize
*/
export const normalizeLicense = (license, count = 8) => {
const parts = [];
while (license.length) {
parts.push(license.substr(0, count));
license = license.substr(count);
}
parts[1] = parts[1].replace(/./g, '*');
parts[2] = parts[2].replace(/./g, '*');
return parts.join('-');
};

View File

@@ -0,0 +1,9 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* Replaces back slashes and correctly concatenates several parts of the path.
*/
export declare const normalizePath: (...path: string[]) => string;

View File

@@ -0,0 +1,27 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module helpers/normalize
*/
import { trim } from "../string/trim.js";
/**
* Replaces back slashes and correctly concatenates several parts of the path.
*/
export const normalizePath = (...path) => {
return path
.filter(part => trim(part).length)
.map((part, index) => {
part = part.replace(/([^:])[\\/]+/g, '$1/');
if (index) {
part = part.replace(/^\//, '');
}
if (index !== path.length - 1) {
part = part.replace(/\/$/, '');
}
return part;
})
.join('/');
};

View File

@@ -0,0 +1,9 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module helpers/normalize
*/
export declare const normalizeRelativePath: (path: string) => string;

View File

@@ -0,0 +1,30 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module helpers/normalize
*/
export const normalizeRelativePath = (path) => {
const sections = path.split('/'), builder = sections.reduce((builder, section) => {
switch (section) {
case '': {
break;
}
case '.': {
break;
}
case '..': {
builder.pop();
break;
}
default: {
builder.push(section);
break;
}
}
return builder;
}, []);
return builder.join('/') + (path.endsWith('/') ? '/' : '');
};

View File

@@ -0,0 +1,12 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module helpers/normalize
*/
/**
* Normalize value to CSS meters
*/
export declare const normalizeSize: (value: string | number, units: "px" | "pt") => string;

View File

@@ -0,0 +1,17 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module helpers/normalize
*/
/**
* Normalize value to CSS meters
*/
export const normalizeSize = (value, units) => {
if (/^[0-9]+$/.test(value.toString())) {
return value + units;
}
return value.toString();
};

Some files were not shown because too many files have changed in this diff Show More