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,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 view
*/
import type { IDictionary, IPluginButton, IToolbarCollection, IViewOptions, IViewWithToolbar } from "../../types/index";
import { View } from "./view";
export declare abstract class ViewWithToolbar extends View implements IViewWithToolbar {
TOOLBAR: IToolbarCollection;
toolbar: this['TOOLBAR'];
private __defaultToolbarContainer;
/**
* Container for toolbar
*/
get toolbarContainer(): HTMLElement;
/**
* Change panel container
*/
setPanel(element: HTMLElement | string): void;
/**
* Helper for appended toolbar in its place
*/
protected buildToolbar(): void;
registeredButtons: Set<IPluginButton>;
private groupToButtons;
getRegisteredButtonGroups(): IDictionary<string[]>;
/**
* Register button for a group
*/
registerButton(btn: IPluginButton): this;
/**
* Remove button from a group
*/
unregisterButton(btn: IPluginButton): this;
/**
* Prepare toolbar items and append buttons in groups
*/
private beforeToolbarBuild;
readonly isJodit: boolean;
private __tooltip;
/** @override **/
protected constructor(options?: Partial<IViewOptions>, isJodit?: boolean);
destruct(): void;
}

150
node_modules/jodit/esm/core/view/view-with-toolbar.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
*/
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 } from "../component/statuses.js";
import { autobind } from "../decorators/autobind/autobind.js";
import { watch } from "../decorators/watch/watch.js";
import { Dom } from "../dom/dom.js";
import { splitArray } from "../helpers/array/index.js";
import { isString } from "../helpers/checker/is-string.js";
import { resolveElement } from "../helpers/utils/selector.js";
import { UITooltip } from "../ui/index.js";
import { isButtonGroup } from "../ui/helpers/buttons.js";
import { View } from "./view.js";
import { makeCollection } from "../../modules/toolbar/factory.js";
export class ViewWithToolbar extends View {
/**
* Container for toolbar
*/
get toolbarContainer() {
if (!this.o.fullsize &&
(isString(this.o.toolbar) || Dom.isHTMLElement(this.o.toolbar))) {
return resolveElement(this.o.toolbar, this.o.shadowRoot || this.od);
}
this.o.toolbar &&
Dom.appendChildFirst(this.container, this.__defaultToolbarContainer);
return this.__defaultToolbarContainer;
}
/**
* Change panel container
*/
setPanel(element) {
this.o.toolbar = element;
this.buildToolbar();
}
/**
* Helper for appended toolbar in its place
*/
buildToolbar() {
var _a;
if (!this.o.toolbar) {
return;
}
const buttons = this.o.buttons
? splitArray(this.o.buttons)
: [];
(_a = this.toolbar) === null || _a === void 0 ? void 0 : _a.setRemoveButtons(this.o.removeButtons).build(buttons.concat(this.o.extraButtons || [])).appendTo(this.toolbarContainer);
}
getRegisteredButtonGroups() {
return this.groupToButtons;
}
/**
* Register button for a group
*/
registerButton(btn) {
var _a;
this.registeredButtons.add(btn);
const group = (_a = btn.group) !== null && _a !== void 0 ? _a : 'other';
if (!this.groupToButtons[group]) {
this.groupToButtons[group] = [];
}
if (btn.position != null) {
this.groupToButtons[group][btn.position] = btn.name;
}
else {
this.groupToButtons[group].push(btn.name);
}
return this;
}
/**
* Remove button from a group
*/
unregisterButton(btn) {
var _a;
this.registeredButtons.delete(btn);
const groupName = (_a = btn.group) !== null && _a !== void 0 ? _a : 'other', group = this.groupToButtons[groupName];
if (group) {
const index = group.indexOf(btn.name);
if (index !== -1) {
group.splice(index, 1);
}
if (group.length === 0) {
delete this.groupToButtons[groupName];
}
}
return this;
}
/**
* Prepare toolbar items and append buttons in groups
*/
beforeToolbarBuild(items) {
if (Object.keys(this.groupToButtons).length) {
return items.map(item => {
if (isButtonGroup(item) &&
item.group &&
this.groupToButtons[item.group]) {
return {
group: item.group,
buttons: [
...item.buttons,
...this.groupToButtons[item.group]
]
};
}
return item;
});
}
}
/** @override **/
constructor(options, isJodit = false) {
super(options, isJodit);
this.toolbar = makeCollection(this);
this.__defaultToolbarContainer = this.c.div('jodit-toolbar__box');
this.registeredButtons = new Set();
this.groupToButtons = {};
this.isJodit = false;
this.__tooltip = new UITooltip(this);
this.isJodit = isJodit;
this.e.on('beforeToolbarBuild', this.beforeToolbarBuild);
}
destruct() {
if (this.isDestructed) {
return;
}
this.setStatus(STATUSES.beforeDestruct);
this.e.off('beforeToolbarBuild', this.beforeToolbarBuild);
this.__tooltip.destruct();
this.toolbar.destruct();
// @ts-ignore After destruct, we are not responsible for anything
this.toolbar = undefined;
super.destruct();
}
}
__decorate([
watch(':rebuildToolbar')
], ViewWithToolbar.prototype, "buildToolbar", null);
__decorate([
autobind
], ViewWithToolbar.prototype, "beforeToolbarBuild", null);

138
node_modules/jodit/esm/core/view/view.d.ts generated vendored Normal file
View File

@@ -0,0 +1,138 @@
/*!
* 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/view/README.md]]
* @packageDocumentation
* @module view
*/
import type { IComponent, ICreate, IDictionary, IEventEmitter, IMessages, IProgressBar, IStorage, IViewBased, IViewOptions, Nullable } from "../../types/index";
import { Component } from "../component/component";
import { Elms } from "../traits/elms";
import { Mods } from "../traits/mods";
export interface View extends Mods, Elms {
}
export declare abstract class View extends Component implements IViewBased, Mods, Elms {
readonly isJodit: boolean;
readonly isView: true;
parent: Nullable<IViewBased>;
readonly mods: IDictionary<string | boolean | null>;
/**
* ID attribute for a source element, id add `{id}_editor` it's editor's id
*/
id: string;
/**
* All created ViewComponent inside this view
*/
readonly components: Set<IComponent>;
/**
* Get a path for loading extra staff
*/
get basePath(): string;
/**
* Plugin autoloader should load minified version of the file
*/
get minified(): boolean;
static readonly ES: 'es5' | 'es2015' | 'es2018' | 'es2021';
static readonly version: string;
static readonly esNext: boolean;
static readonly esModern: boolean;
/**
* Return a default timeout period in milliseconds for some debounce or throttle functions.
* By default, `{history.timeout}` options
*/
get defaultTimeout(): number;
/**
* Some extra data inside editor
* @see copyformat plugin
*/
get buffer(): IStorage;
get message(): IMessages;
protected getMessageModule(container: HTMLElement): IMessages;
/**
* Container for persistent set/get value
*/
get storage(): IStorage;
readonly create: ICreate;
/**
* Short alias for `create`
*/
get c(): this['create'];
protected __container: HTMLDivElement;
get container(): HTMLDivElement;
set container(container: HTMLDivElement);
events: IEventEmitter;
/**
* Short alias for `events`
*/
get e(): this['events'];
/**
* progress_bar Progress bar
*/
get progressbar(): IProgressBar;
OPTIONS: IViewOptions;
protected __options: this['OPTIONS'];
get options(): this['OPTIONS'];
set options(options: this['OPTIONS']);
/**
* Short alias for options
*/
get o(): this['options'];
/**
* Internationalization method. Uses Jodit.lang object
*/
i18n(text: string, ...params: Array<string | number>): string;
private __isFullSize;
toggleFullSize(isFullSize?: boolean): void;
private __whoLocked;
/**
* View is locked
*/
get isLocked(): boolean;
isLockedNotBy: (name: string) => boolean;
/**
* Disable selecting
*/
lock(name?: string): boolean;
/**
* Enable selecting
*/
unlock(): boolean;
/**
* View is in fullSize
*/
get isFullSize(): boolean;
/**
* Return current version
*/
getVersion(): string;
static getVersion(): string;
/** @override */
protected initOptions(options?: Partial<IViewOptions>): void;
/**
* Can change ownerWindow here
*/
protected initOwners(): void;
/**
* Add option's event handlers in emitter
*/
protected attachEvents(options?: IViewOptions): void;
protected constructor(options?: Partial<IViewOptions>, isJodit?: boolean);
private __modulesInstances;
/**
* Make one instance of one module
*/
getInstance<T extends IComponent>(module: Function, options?: object): T;
getInstance<T extends IComponent>(moduleName: string, options?: object): T;
/** Add some element to box */
protected addDisclaimer(elm: HTMLElement): void;
/**
* Call before destruct
*/
protected beforeDestruct(): void;
/** @override */
destruct(): void;
static defaultOptions: IViewOptions;
}

316
node_modules/jodit/esm/core/view/view.js generated vendored Normal file
View File

@@ -0,0 +1,316 @@
/*!
* 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;
};
var View_1;
import { ViewComponent } from "../component/index.js";
import { Component } from "../component/component.js";
import { STATUSES } from "../component/statuses.js";
import { APP_VERSION, BASE_PATH, BASE_PATH_IS_MIN, ES, IS_ES_MODERN, IS_ES_NEXT } from "../constants.js";
import { Create } from "../create/create.js";
import { cache, cached } from "../decorators/cache/cache.js";
import { derive } from "../decorators/derive/derive.js";
import { hook } from "../decorators/hook/hook.js";
import { Dom } from "../dom/index.js";
import { EventEmitter } from "../event-emitter/index.js";
import { modules } from "../global.js";
import { camelCase, ConfigProto, error, i18n, isDestructable, isFunction, isVoid } from "../helpers/index.js";
import { Storage } from "../storage/storage.js";
import { Elms } from "../traits/elms.js";
import { Mods } from "../traits/mods.js";
import { ProgressBar } from "../ui/progress-bar/progress-bar.js";
import { UIMessages } from "../../modules/messages/messages.js";
let View = View_1 = class View extends Component {
/**
* Get a path for loading extra staff
*/
get basePath() {
if (this.o.basePath) {
return this.o.basePath;
}
return BASE_PATH;
}
/**
* Plugin autoloader should load minified version of the file
*/
get minified() {
if (this.o.minified !== undefined) {
return this.o.minified;
}
return BASE_PATH_IS_MIN;
}
/**
* Return a default timeout period in milliseconds for some debounce or throttle functions.
* By default, `{history.timeout}` options
*/
get defaultTimeout() {
return isVoid(this.o.defaultTimeout) ? 100 : this.o.defaultTimeout;
}
/**
* Some extra data inside editor
* @see copyformat plugin
*/
get buffer() {
return Storage.makeStorage();
}
get message() {
return this.getMessageModule(this.container);
}
getMessageModule(container) {
return new UIMessages(this, container);
}
/**
* Container for persistent set/get value
*/
get storage() {
return Storage.makeStorage(true, this.id);
}
/**
* Short alias for `create`
*/
get c() {
return this.create;
}
get container() {
return this.__container;
}
set container(container) {
this.__container = container;
}
/**
* Short alias for `events`
*/
get e() {
return this.events;
}
/**
* progress_bar Progress bar
*/
get progressbar() {
return new ProgressBar(this);
}
get options() {
return this.__options;
}
set options(options) {
this.__options = options;
}
/**
* Short alias for options
*/
get o() {
return this.options;
}
/**
* Internationalization method. Uses Jodit.lang object
*/
i18n(text, ...params) {
return i18n(text, params, this.options);
}
toggleFullSize(isFullSize) {
if (isFullSize === undefined) {
isFullSize = !this.__isFullSize;
}
if (isFullSize === this.__isFullSize) {
return;
}
this.__isFullSize = isFullSize;
this.e.fire('toggleFullSize', isFullSize);
}
/**
* View is locked
*/
get isLocked() {
return this.__whoLocked !== '';
}
/**
* Disable selecting
*/
lock(name = 'any') {
if (!this.isLocked) {
this.__whoLocked = name;
return true;
}
return false;
}
/**
* Enable selecting
*/
unlock() {
if (this.isLocked) {
this.__whoLocked = '';
return true;
}
return false;
}
/**
* View is in fullSize
*/
get isFullSize() {
return this.__isFullSize;
}
/**
* Return current version
*/
getVersion() {
return View_1.version;
}
static getVersion() {
return View_1.version;
}
/** @override */
initOptions(options) {
this.options = ConfigProto(options || {}, ConfigProto(this.options || {}, View_1.defaultOptions));
}
/**
* Can change ownerWindow here
*/
initOwners() {
var _a;
this.ownerWindow = (_a = this.o.ownerWindow) !== null && _a !== void 0 ? _a : window;
}
/**
* Add option's event handlers in emitter
*/
attachEvents(options) {
if (!options) {
return;
}
const e = options === null || options === void 0 ? void 0 : options.events;
e && Object.keys(e).forEach((key) => this.e.on(key, e[key]));
}
constructor(options, isJodit = false) {
super();
this.isJodit = isJodit;
this.isView = true;
this.parent = null;
this.mods = {};
/**
* All created ViewComponent inside this view
*/
this.components = new Set();
this.OPTIONS = View_1.defaultOptions;
this.__isFullSize = false;
this.__whoLocked = '';
this.isLockedNotBy = (name) => this.isLocked && this.__whoLocked !== name;
this.__modulesInstances = new Map();
this.id = new Date().getTime().toString();
this.initOptions(options);
this.initOwners();
this.events = new EventEmitter(this.od);
this.create = new Create(this.od);
this.__container = this.c.div(`jodit ${this.componentName}`);
}
getInstance(moduleNameOrConstructor, options) {
const moduleName = isFunction(moduleNameOrConstructor)
? moduleNameOrConstructor.prototype.className()
: moduleNameOrConstructor;
const instance = this.e.fire(camelCase('getInstance_' + moduleName), options);
if (instance) {
return instance;
}
const module = isFunction(moduleNameOrConstructor)
? moduleNameOrConstructor
: modules[moduleName], mi = this.__modulesInstances;
if (!isFunction(module)) {
throw error('Need real module name');
}
if (!mi.has(moduleName)) {
const instance = module.prototype instanceof ViewComponent
? new module(this, options)
: new module(options);
this.components.add(instance);
mi.set(moduleName, instance);
}
return mi.get(moduleName);
}
/** Add some element to box */
addDisclaimer(elm) {
this.container.appendChild(elm);
}
/**
* Call before destruct
*/
beforeDestruct() {
this.e.fire(STATUSES.beforeDestruct, this);
this.components.forEach(component => {
if (isDestructable(component) && !component.isInDestruct) {
component.destruct();
}
});
this.components.clear();
}
/** @override */
destruct() {
var _a, _b, _c;
if (this.isDestructed) {
return;
}
(_a = cached(this, 'progressbar')) === null || _a === void 0 ? void 0 : _a.destruct();
(_b = cached(this, 'message')) === null || _b === void 0 ? void 0 : _b.destruct();
if (this.events) {
this.events.destruct();
// @ts-ignore
this.events = undefined;
}
(_c = cached(this, 'buffer')) === null || _c === void 0 ? void 0 : _c.clear();
Dom.safeRemove(this.container);
super.destruct();
}
};
// from webpack.config.ts
View.ES = ES;
View.version = APP_VERSION;
View.esNext = IS_ES_NEXT; // from webpack.config.ts
View.esModern = IS_ES_MODERN; // from webpack.config.ts
__decorate([
cache
], View.prototype, "buffer", null);
__decorate([
cache
], View.prototype, "message", null);
__decorate([
cache
], View.prototype, "storage", null);
__decorate([
cache
], View.prototype, "c", null);
__decorate([
cache
], View.prototype, "e", null);
__decorate([
cache
], View.prototype, "progressbar", null);
__decorate([
hook(STATUSES.beforeDestruct)
], View.prototype, "beforeDestruct", null);
View = View_1 = __decorate([
derive(Mods, Elms)
], View);
export { View };
View.defaultOptions = {
extraButtons: [],
cache: true,
textIcons: false,
namespace: '',
removeButtons: [],
zIndex: 100002,
defaultTimeout: 100,
fullsize: false,
showTooltip: true,
useNativeTooltip: false,
buttons: [],
globalFullSize: true,
language: 'auto'
};