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,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 plugins/dtd
* @internal
*/
export * from "./remove-extra-br";

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 plugins/dtd
* @internal
*/
export * from "./remove-extra-br.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 plugins/dtd
* @internal
*/
import type { IJodit } from "../../../types/index";
/**
* Checks if there is a tag in the block element after the inserted br node,
* if so, removes it
* @internal
*/
export declare function removeExtraBr(jodit: IJodit, node: Node): void;

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
*/
import { Dom } from "../../../core/dom/dom.js";
const brBoxes = new Set([
'table',
'pre',
'blockquote',
'code'
]);
/**
* Checks if there is a tag in the block element after the inserted br node,
* if so, removes it
* @internal
*/
export function removeExtraBr(jodit, node) {
if (!jodit.o.dtd.removeExtraBr || Dom.isTag(node, 'br')) {
return;
}
const parent = Dom.furthest(node, Dom.isBlock, jodit.editor);
if (parent && !Dom.isTag(parent, brBoxes)) {
const br = Dom.isTag(node, 'br')
? node
: Dom.findNotEmptySibling(node, false);
if (!Dom.isTag(br, 'br')) {
return;
}
jodit.s.setCursorBefore(br);
Dom.safeRemove(br);
}
}

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 plugins/dtd
* @internal
*/
import type { IJodit, Nullable } from "../../../types/index";
/**
* Checks whether the insertion of an element at the current location is allowed,
* if it is not allowed, it deletes an empty block element or moves the cursor after it
* @internal
*/
export declare function checkBlockNesting(jodit: IJodit, node: Nullable<Node>): void;

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
*/
import { Dom } from "../../../core/dom/dom.js";
/**
* Checks whether the insertion of an element at the current location is allowed,
* if it is not allowed, it deletes an empty block element or moves the cursor after it
* @internal
*/
export function checkBlockNesting(jodit, node) {
if (Dom.isFragment(node)) {
node = node.firstChild;
}
if (jodit.o.dtd.checkBlockNesting && Dom.isBlock(node)) {
const parent = Dom.furthest(jodit.s.current(), Dom.isBlock, jodit.editor);
if (parent && !jodit.o.dtd.blockLimits[parent.tagName.toLowerCase()]) {
jodit.s.setCursorAfter(parent);
if (Dom.isEmpty(parent)) {
Dom.safeRemove(parent);
}
}
}
}

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 plugins/dtd
* @internal
*/
export * from "./check-block-nesting";

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 plugins/dtd
* @internal
*/
export * from "./check-block-nesting.js";

27
node_modules/jodit/esm/plugins/dtd/config.d.ts generated vendored Normal file
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 plugins/dtd
*/
import type { IDictionary } from "../../types/index";
declare module 'jodit/config' {
interface Config {
dtd: {
/**
* Remove extra br element inside block element after pasting
*/
removeExtraBr: boolean;
/**
* Check when inserting a block element if it can be inside another block element (according `blockLimits`)
*/
checkBlockNesting: boolean;
/**
* List of elements that contain other blocks
*/
blockLimits: IDictionary<1>;
};
}
}

39
node_modules/jodit/esm/plugins/dtd/config.js generated vendored Normal file
View File

@@ -0,0 +1,39 @@
/*!
* 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 { Config } from "../../config.js";
Config.prototype.dtd = {
removeExtraBr: true,
checkBlockNesting: true,
blockLimits: {
article: 1,
aside: 1,
audio: 1,
body: 1,
caption: 1,
details: 1,
dir: 1,
div: 1,
dl: 1,
fieldset: 1,
figcaption: 1,
figure: 1,
footer: 1,
form: 1,
header: 1,
hgroup: 1,
main: 1,
menu: 1,
nav: 1,
ol: 1,
section: 1,
table: 1,
td: 1,
th: 1,
tr: 1,
ul: 1,
video: 1
}
};

6
node_modules/jodit/esm/plugins/dtd/dtd.d.ts generated vendored Normal file
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
*/
import "./config";

44
node_modules/jodit/esm/plugins/dtd/dtd.js generated vendored Normal file
View File

@@ -0,0 +1,44 @@
/*!
* 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 { watch } from "../../core/decorators/watch/watch.js";
import { pluginSystem } from "../../core/global.js";
import { Plugin } from "../../core/plugin/index.js";
import "./config.js";
import * as afterInsertCases from "./after-insert/index.js";
import * as beforeInsertCases from "./before-insert/index.js";
class dtd extends Plugin {
afterInit(jodit) { }
beforeDestruct(jodit) { }
__onBeforeInsertNode(node) {
const casesKeys = Object.keys(beforeInsertCases);
casesKeys.forEach(key => {
beforeInsertCases[key](this.j, node);
});
}
__onAfterInsertNode(node) {
const casesKeys = Object.keys(afterInsertCases);
casesKeys.forEach(key => {
afterInsertCases[key](this.j, node);
});
}
}
__decorate([
watch(':beforeInsertNode')
], dtd.prototype, "__onBeforeInsertNode", null);
__decorate([
watch(':afterInsertNode')
], dtd.prototype, "__onAfterInsertNode", null);
pluginSystem.add('dtd', dtd);