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
*/
/**
* @module plugin
*/
import type { IJodit, Nullable, PluginInstance, PluginType } from "../../../types/index";
/**
* Init plugin if it has no dependencies, in another case wait requires plugins will be init
* @private
*/
export declare function init(jodit: IJodit, pluginName: string, plugin: PluginType, instance: PluginInstance, doneList: Map<string, Nullable<PluginInstance>>, waitingList: Set<string>): void;

View File

@@ -0,0 +1,37 @@
/*!
* 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 { IS_PROD } from "../../constants.js";
import { getContainer } from "../../global.js";
import { isInitable } from "../../helpers/checker/index.js";
import { loadStyle } from "./load.js";
/**
* Init plugin if it has no dependencies, in another case wait requires plugins will be init
* @private
*/
export function init(jodit, pluginName, plugin, instance, doneList, waitingList) {
if (isInitable(instance)) {
try {
instance.init(jodit);
}
catch (e) {
console.error(e);
if (!IS_PROD) {
throw e;
}
}
}
doneList.set(pluginName, instance);
waitingList.delete(pluginName);
if (instance.hasStyle) {
loadStyle(jodit, pluginName).catch(e => {
!IS_PROD && console.error(e);
});
}
if (instance.styles) {
const style = getContainer(jodit, pluginName, 'style');
style.innerHTML = instance.styles;
}
}

17
node_modules/jodit/esm/core/plugin/helpers/load.d.ts generated vendored Normal file
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 plugin
*/
import type { IExtraPlugin, IJodit, PluginType } from "../../../types/index";
/**
* @private
*/
export declare function loadStyle(jodit: IJodit, pluginName: string): Promise<void>;
/**
* @private
*/
export declare function loadExtras(items: Map<string, PluginType>, jodit: IJodit, extraList: IExtraPlugin[], callback: () => void): void;

65
node_modules/jodit/esm/core/plugin/helpers/load.js generated vendored Normal file
View File

@@ -0,0 +1,65 @@
/*!
* 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 { IS_PROD } from "../../constants.js";
import { kebabCase } from "../../helpers/string/kebab-case.js";
import { appendScriptAsync, appendStyleAsync } from "../../helpers/utils/append-script.js";
import { normalizeName } from "./utils.js";
const styles = new Set();
/**
* @private
*/
export async function loadStyle(jodit, pluginName) {
const url = getFullUrl(jodit, pluginName, false);
if (styles.has(url)) {
return;
}
styles.add(url);
return appendStyleAsync(jodit, url);
}
/**
* Call full url to the script or style file
* @private
*/
function getFullUrl(jodit, name, js) {
name = kebabCase(name);
const min = jodit.minified ? '.min' : '';
return (jodit.basePath +
'plugins/' +
name +
'/' +
name +
min +
'.' +
(js ? 'js' : 'css'));
}
/**
* @private
*/
export function loadExtras(items, jodit, extraList, callback) {
try {
const needLoadExtras = extraList.filter(extra => !items.has(normalizeName(extra.name)));
if (needLoadExtras.length) {
load(jodit, needLoadExtras, callback);
}
}
catch (e) {
if (!IS_PROD) {
throw e;
}
}
}
/**
* Download plugins
* @private
*/
function load(jodit, pluginList, callback) {
pluginList.map(extra => {
const url = extra.url || getFullUrl(jodit, extra.name, true);
return appendScriptAsync(jodit, url)
.then(callback)
.catch(() => null);
});
}

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 plugin
*/
import type { IJodit, Nullable, PluginInstance, PluginType } from "../../../types/index";
/**
* Create instance of plugin
* @private
*/
export declare function makeInstance(jodit: IJodit, plugin: PluginType): Nullable<PluginInstance>;

View File

@@ -0,0 +1,31 @@
/*!
* 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 { IS_PROD } from "../../constants.js";
import { isFunction } from "../../helpers/checker/is-function.js";
/**
* Create instance of plugin
* @private
*/
export function makeInstance(jodit, plugin) {
try {
try {
// @ts-ignore
return isFunction(plugin) ? new plugin(jodit) : plugin;
}
catch (e) {
if (isFunction(plugin) && !plugin.prototype) {
return plugin(jodit);
}
}
}
catch (e) {
console.error(e);
if (!IS_PROD) {
throw e;
}
}
return 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
*/
/**
* @private
*/
export declare function normalizeName(name: string): string;

15
node_modules/jodit/esm/core/plugin/helpers/utils.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 plugin
*/
import { kebabCase } from "../../helpers/string/kebab-case.js";
/**
* @private
*/
export function normalizeName(name) {
return kebabCase(name).toLowerCase();
}

10
node_modules/jodit/esm/core/plugin/index.d.ts generated vendored Normal file
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 plugin
*/
export * from "./plugin";
export * from "./plugin-system";

10
node_modules/jodit/esm/core/plugin/index.js generated vendored Normal file
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 plugin
*/
export * from "./plugin.js";
export * from "./plugin-system.js";

17
node_modules/jodit/esm/core/plugin/interface.d.ts generated vendored Normal file
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 plugin
*/
declare module 'jodit/types/events' {
interface IEventEmitter {
/**
* Emitted every time after the plugins have been initialized
* or a deferred plugin has been loaded and also initialized
*/
on(event: 'updatePlugins', callback: () => void): this;
}
}

1
node_modules/jodit/esm/core/plugin/interface.js generated vendored Normal file
View File

@@ -0,0 +1 @@
"use strict";

47
node_modules/jodit/esm/core/plugin/plugin-system.d.ts generated vendored Normal file
View File

@@ -0,0 +1,47 @@
/*!
* 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 plugin
*/
import type { IJodit, IPluginSystem, PluginType } from "../../types/index";
import "./interface";
/**
* Jodit plugin system
* @example
* ```js
* Jodit.plugins.add('emoji2', {
* init() {
* alert('emoji Inited2')
* },
* destruct() {}
* });
* ```
*/
export declare class PluginSystem implements IPluginSystem {
private __items;
get size(): number;
/**
* Add plugin in store
*/
add(name: string, plugin: PluginType): void;
/**
* Get plugin from store
*/
get(name: string): PluginType | void;
/**
* Remove plugin from store
*/
remove(name: string): void;
private __getFullPluginsList;
/**
* Public method for async init all plugins
*/
__init(jodit: IJodit): void;
/**
* Returns the promise to wait for the plugin to load.
*/
wait(name: string): Promise<void>;
}

150
node_modules/jodit/esm/core/plugin/plugin-system.js generated vendored Normal file
View File

@@ -0,0 +1,150 @@
/*!
* 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 { IS_PROD } from "../constants.js";
import { eventEmitter } from "../global.js";
import { splitArray } from "../helpers/array/index.js";
import { isArray, isDestructable, isString } from "../helpers/checker/index.js";
import { init } from "./helpers/init-instance.js";
import { loadExtras } from "./helpers/load.js";
import { makeInstance } from "./helpers/make-instance.js";
import { normalizeName } from "./helpers/utils.js";
import "./interface.js";
/**
* Jodit plugin system
* @example
* ```js
* Jodit.plugins.add('emoji2', {
* init() {
* alert('emoji Inited2')
* },
* destruct() {}
* });
* ```
*/
export class PluginSystem {
constructor() {
this.__items = new Map();
}
get size() {
return this.__items.size;
}
/**
* Add plugin in store
*/
add(name, plugin) {
this.__items.set(normalizeName(name), plugin);
eventEmitter.fire(`plugin:${name}:ready`);
}
/**
* Get plugin from store
*/
get(name) {
return this.__items.get(normalizeName(name));
}
/**
* Remove plugin from store
*/
remove(name) {
this.__items.delete(normalizeName(name));
}
__getFullPluginsList(filter) {
const results = [];
this.__items.forEach((plugin, name) => {
if (!filter || filter.has(name)) {
results.push([name, plugin]);
}
});
return results;
}
/**
* Public method for async init all plugins
*/
__init(jodit) {
const { extraList, disableList, filter } = getSpecialLists(jodit);
const doneList = new Map();
const pluginsMap = {};
const waitingList = new Set();
jodit.__plugins = pluginsMap;
const initPlugins = () => {
if (jodit.isInDestruct) {
return;
}
let commit = false;
this.__getFullPluginsList(filter).forEach(([name, plugin]) => {
if (disableList.has(name) || doneList.has(name)) {
return;
}
const requires = plugin === null || plugin === void 0 ? void 0 : plugin.requires;
if (requires && isArray(requires) && requires.length) {
if (requires.some(req => disableList.has(req))) {
return;
}
if (!requires.every(name => doneList.has(name))) {
waitingList.add(name);
return;
}
}
commit = true;
const instance = makeInstance(jodit, plugin);
if (!instance) {
doneList.set(name, null);
waitingList.delete(name);
return;
}
init(jodit, name, plugin, instance, doneList, waitingList);
pluginsMap[name] = instance;
});
if (commit) {
jodit.e.fire('updatePlugins');
initPlugins();
}
};
if (extraList && extraList.length) {
loadExtras(this.__items, jodit, extraList, initPlugins);
}
initPlugins();
bindOnBeforeDestruct(jodit, pluginsMap);
if (!IS_PROD && waitingList.size) {
console.warn('After init plugin waiting list is not clean:', waitingList);
}
}
/**
* Returns the promise to wait for the plugin to load.
*/
wait(name) {
return new Promise((resolve) => {
if (this.get(name)) {
return resolve();
}
const onReady = () => {
resolve();
eventEmitter.off(`plugin:${name}:ready`, onReady);
};
eventEmitter.on(`plugin:${name}:ready`, onReady);
});
}
}
/**
* Destroy all plugins before - Jodit will be destroyed
*/
function bindOnBeforeDestruct(jodit, plugins) {
jodit.e.on('beforeDestruct', () => {
Object.keys(plugins).forEach(name => {
const instance = plugins[name];
if (isDestructable(instance)) {
instance.destruct(jodit);
}
delete plugins[name];
});
delete jodit.__plugins;
});
}
function getSpecialLists(jodit) {
const extraList = jodit.o.extraPlugins.map(s => isString(s) ? { name: s } : s);
const disableList = new Set(splitArray(jodit.o.disablePlugins).map(normalizeName));
const filter = jodit.o.safeMode ? new Set(jodit.o.safePluginsList) : null;
return { extraList, disableList, filter };
}

41
node_modules/jodit/esm/core/plugin/plugin.d.ts generated vendored Normal file
View File

@@ -0,0 +1,41 @@
/*!
* 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/plugin/README.md]]
* @packageDocumentation
* @module plugin
*/
import type { CanUndef, IJodit, IPlugin, IViewBased } from "../../types/index";
import { ViewComponent } from "../component/index";
export declare abstract class Plugin<T extends IViewBased = IJodit> extends ViewComponent<T> implements IPlugin<T> {
static requires: string[];
/** @override */
buttons: IPlugin['buttons'];
/**
* Plugin have CSS style and it should be loaded
*/
hasStyle: boolean;
/**
* Additional plugin styles can be written simply as inline styles
* ```js
* class A extends Jodit.modules.Plugin {
* styles = 'h1{color: red}';
* }
* ```
* Will only be applied if the plugin is activated
*/
styles: CanUndef<string>;
/** @override */
className(): string;
private __inited;
protected abstract afterInit(jodit: T): void;
protected abstract beforeDestruct(jodit: T): void;
constructor(jodit: T);
private __afterPluginSystemInit;
private __afterInit;
init(jodit: T): void;
private __beforeDestruct;
}

90
node_modules/jodit/esm/core/plugin/plugin.js generated vendored Normal file
View File

@@ -0,0 +1,90 @@
/*!
* 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
*/
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
r = Reflect.decorate(decorators, target, key, desc);
else
for (var i = decorators.length - 1; i >= 0; i--)
if (d = decorators[i])
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
import { STATUSES, ViewComponent } from "../component/index.js";
import { autobind } from "../decorators/index.js";
import { isJoditObject } from "../helpers/checker/is-jodit-object.js";
export class Plugin extends ViewComponent {
/** @override */
className() {
return 'Plugin';
}
constructor(jodit) {
super(jodit);
/** @override */
this.buttons = [];
/**
* Plugin have CSS style and it should be loaded
*/
this.hasStyle = false;
this.__inited = false;
jodit.e
.on('afterPluginSystemInit', this.__afterPluginSystemInit)
.on('afterInit', this.__afterInit)
.on('beforeDestruct', this.__beforeDestruct);
}
__afterPluginSystemInit() {
const { j, buttons } = this;
if (buttons && isJoditObject(j)) {
buttons.forEach(btn => {
j.registerButton(btn);
});
}
}
__afterInit() {
this.__inited = true;
this.setStatus(STATUSES.ready);
this.afterInit(this.jodit);
}
init(jodit) {
if (this.jodit.isReady) {
this.afterInit(this.jodit);
this.__afterPluginSystemInit();
this.jodit.e.fire('rebuildToolbar');
}
}
__beforeDestruct() {
var _a;
if (this.isInDestruct) {
return;
}
const { j } = this;
j.e
.off('afterPluginSystemInit', this.__afterPluginSystemInit)
.off('afterInit', this.__afterInit)
.off('beforeDestruct', this.destruct);
this.setStatus(STATUSES.beforeDestruct);
if (!this.__inited) {
return super.destruct();
}
if (isJoditObject(j)) {
(_a = this.buttons) === null || _a === void 0 ? void 0 : _a.forEach(btn => {
j === null || j === void 0 ? void 0 : j.unregisterButton(btn);
});
}
this.beforeDestruct(this.j);
super.destruct();
}
}
Plugin.requires = [];
__decorate([
autobind
], Plugin.prototype, "__afterPluginSystemInit", null);
__decorate([
autobind
], Plugin.prototype, "__afterInit", null);
__decorate([
autobind
], Plugin.prototype, "__beforeDestruct", null);