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);
}
}