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

62
node_modules/jodit/esm/core/create/create.d.ts generated vendored Normal file
View File

@@ -0,0 +1,62 @@
/*!
* 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/create/README.md]]
* @packageDocumentation
* @module create
*/
import type { Attributes, CanUndef, Children, ICreate, IDictionary, NodeFunction } from "../../types/index";
export declare class Create implements ICreate {
readonly document: Document | (() => Document);
readonly createAttributes?: CanUndef<IDictionary<Attributes | NodeFunction>>;
private get doc();
constructor(document: Document | (() => Document), createAttributes?: CanUndef<IDictionary<Attributes | NodeFunction>>);
element<K extends keyof HTMLElementTagNameMap>(tagName: K, children?: Children): HTMLElementTagNameMap[K];
element<K extends keyof HTMLElementTagNameMap>(tagName: K, attributes?: Attributes, children?: Children): HTMLElementTagNameMap[K];
div(className?: string, childrenOrAttributes?: Children): HTMLDivElement;
div(className?: string, childrenOrAttributes?: Attributes, children?: Children): HTMLDivElement;
sandbox(): [
HTMLElement,
HTMLIFrameElement
];
span(className?: string, childrenOrAttributes?: Children): HTMLSpanElement;
span(className?: string, childrenOrAttributes?: Attributes, children?: Children): HTMLSpanElement;
a(className?: string, children?: Children): HTMLAnchorElement;
a(className?: string, childrenOrAttributes?: Attributes, children?: Children): HTMLAnchorElement;
/**
* Create text node
*/
text(value: string): Text;
/**
* Create invisible text node
*/
fake(): Text;
/**
* Create HTML Document fragment element
*/
fragment(): DocumentFragment;
/**
* Create a DOM element from HTML text
*
// eslint-disable-next-line tsdoc/syntax
* @param refsToggleElement - State dictionary in which you can set the visibility of some of the elements
* ```js
* const editor = Jodit.make('#editor');
* editor.createInside.fromHTML(`<div>
* <input name="name" ref="name"/>
* <input name="email" ref="email"/>
* </div>`, {
* name: true,
* email: false
* });
* ```
*/
fromHTML<T extends HTMLElement>(html: string | number, refsToggleElement?: IDictionary<boolean | void>): T;
/**
* Apply to element `createAttributes` options
*/
applyCreateAttributes(elm: HTMLElement): void;
}

139
node_modules/jodit/esm/core/create/create.js generated vendored Normal file
View File

@@ -0,0 +1,139 @@
/*!
* 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 { INVISIBLE_SPACE } from "../constants.js";
import { Dom } from "../dom/dom.js";
import { asArray, attr, isFunction, isPlainObject, isString, refs } from "../helpers/index.js";
import { assert } from "../helpers/utils/assert.js";
export class Create {
get doc() {
// @ts-ignore - TODO it's a function
return isFunction(this.document) ? this.document() : this.document;
}
constructor(document, createAttributes) {
this.document = document;
this.createAttributes = createAttributes;
}
element(tagName, childrenOrAttributes, children) {
const elm = this.doc.createElement(tagName.toLowerCase());
this.applyCreateAttributes(elm);
if (childrenOrAttributes) {
if (isPlainObject(childrenOrAttributes)) {
attr(elm, childrenOrAttributes);
}
else {
children = childrenOrAttributes;
}
}
if (children) {
asArray(children).forEach((child) => elm.appendChild(isString(child) ? this.fromHTML(child) : child));
}
return elm;
}
div(className, childrenOrAttributes, children) {
const div = this.element('div', childrenOrAttributes, children);
if (className) {
div.className = className;
}
return div;
}
sandbox() {
var _a;
const iframe = this.element('iframe', { sandbox: 'allow-same-origin' });
this.doc.body.appendChild(iframe);
const doc = (_a = iframe.contentWindow) === null || _a === void 0 ? void 0 : _a.document;
assert(doc, 'iframe.contentWindow.document');
if (!doc) {
throw Error('Iframe error');
}
doc.open();
doc.write('<!DOCTYPE html><html><head></head><body></body></html>');
doc.close();
return [doc.body, iframe];
}
span(className, childrenOrAttributes, children) {
const span = this.element('span', childrenOrAttributes, children);
if (className) {
span.className = className;
}
return span;
}
a(className, childrenOrAttributes, children) {
const a = this.element('a', childrenOrAttributes, children);
if (className) {
a.className = className;
}
return a;
}
/**
* Create text node
*/
text(value) {
return this.doc.createTextNode(value);
}
/**
* Create invisible text node
*/
fake() {
return this.text(INVISIBLE_SPACE);
}
/**
* Create HTML Document fragment element
*/
fragment() {
return this.doc.createDocumentFragment();
}
/**
* Create a DOM element from HTML text
*
// eslint-disable-next-line tsdoc/syntax
* @param refsToggleElement - State dictionary in which you can set the visibility of some of the elements
* ```js
* const editor = Jodit.make('#editor');
* editor.createInside.fromHTML(`<div>
* <input name="name" ref="name"/>
* <input name="email" ref="email"/>
* </div>`, {
* name: true,
* email: false
* });
* ```
*/
fromHTML(html, refsToggleElement) {
const div = this.div();
div.innerHTML = html.toString();
const child = div.firstChild !== div.lastChild || !div.firstChild
? div
: div.firstChild;
Dom.safeRemove(child);
if (refsToggleElement) {
const refElements = refs(child);
Object.keys(refsToggleElement).forEach(key => {
const elm = refElements[key];
if (elm && refsToggleElement[key] === false) {
Dom.hide(elm);
}
});
}
return child;
}
/**
* Apply to element `createAttributes` options
*/
applyCreateAttributes(elm) {
if (this.createAttributes) {
const ca = this.createAttributes;
if (ca && ca[elm.tagName.toLowerCase()]) {
const attrsOpt = ca[elm.tagName.toLowerCase()];
if (isFunction(attrsOpt)) {
attrsOpt(elm);
}
else if (isPlainObject(attrsOpt)) {
attr(elm, attrsOpt);
}
}
}
}
}

9
node_modules/jodit/esm/core/create/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 create
*/
export * from "./create";

9
node_modules/jodit/esm/core/create/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 create
*/
export * from "./create.js";