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

9
node_modules/jodit/esm/plugins/tab/cases/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 plugins/tab
*/
export * from "./on-tab-inside-li";

9
node_modules/jodit/esm/plugins/tab/cases/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 plugins/tab
*/
export * from "./on-tab-inside-li.js";

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 plugins/tab
*/
import type { IJodit } from "../../../types/index";
/**
* Checks if the cursor is at the beginning of the LI element when tabbed.
* If so then add an internal list
* @private
*/
export declare function onTabInsideLi(jodit: IJodit, shift?: boolean): boolean;

View File

@@ -0,0 +1,105 @@
/*!
* 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";
import { assert } from "../../../core/helpers/utils/assert.js";
/**
* Checks if the cursor is at the beginning of the LI element when tabbed.
* If so then add an internal list
* @private
*/
export function onTabInsideLi(jodit, shift = false) {
if (!jodit.o.tab.tabInsideLiInsertNewList) {
return false;
}
const [fake, fake2] = fakeCursors(jodit);
try {
const li = getParentLeaf(jodit, fake, shift);
if (!li) {
return false;
}
if (!isSameLeftCursorPosition(li, jodit, fake)) {
return false;
}
const list = Dom.closest(li, ['ol', 'ul'], jodit.editor);
if (!list || (shift && !Dom.closest(list, 'li', jodit.editor))) {
return false;
}
if (!shift) {
appendNestedList(jodit, list, li);
}
else {
removeNestedList(jodit, list, li);
}
return true;
}
finally {
const range = jodit.s.createRange();
range.setStartAfter(fake);
range.setEndBefore(fake2);
jodit.s.selectRange(range);
Dom.safeRemove(fake);
Dom.safeRemove(fake2);
}
return false;
}
function fakeCursors(jodit) {
const fake = jodit.createInside.fake();
const fake2 = jodit.createInside.fake();
const r = jodit.s.range.cloneRange();
r.collapse(true);
r.insertNode(fake);
const r2 = jodit.s.range.cloneRange();
r2.collapse(false);
r2.insertNode(fake2);
return [fake, fake2];
}
function getParentLeaf(jodit, fake, shift) {
const li = Dom.closest(fake, 'li', jodit.editor);
if (!li) {
return false;
}
if (!shift && !Dom.isLeaf(li.previousElementSibling)) {
return false;
}
if (shift && !Dom.closest(li, 'li', jodit.editor)) {
return false;
}
return li;
}
function isSameLeftCursorPosition(li, jodit, fake) {
const li2 = Dom.closest(fake, 'li', jodit.editor);
return !(!li2 || (li2 !== li && !li.contains(li2)));
}
function appendNestedList(jodit, list, li) {
const previousLi = li.previousElementSibling;
assert(previousLi, 'tab previousElementSibling is null');
const lastElm = previousLi.lastElementChild;
const newList = Dom.isTag(lastElm, list.tagName)
? lastElm
: jodit.createInside.element(list.tagName, Array.from(list.attributes).reduce((acc, attr) => {
acc[attr.name] = attr.value;
return acc;
}, {}));
newList.appendChild(li);
lastElm !== newList && previousLi.appendChild(newList);
}
function removeNestedList(jodit, list, li) {
const parentLi = Dom.closest(list, 'li', jodit.editor);
assert(parentLi, 'tab parent li is null');
const items = Array.from(list.children).filter(t => Dom.isLeaf(t));
Dom.after(parentLi, li);
const index = items.indexOf(li);
if (index === 0 || items.length === 1) {
Dom.safeRemove(list);
}
if (index !== items.length - 1) {
const clone = list.cloneNode();
Dom.append(li, clone);
for (let i = index + 1; i < items.length; i += 1) {
Dom.append(clone, items[i]);
}
}
}

16
node_modules/jodit/esm/plugins/tab/config.d.ts generated vendored Normal file
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
*/
declare module 'jodit/config' {
interface Config {
tab: {
/**
* Pressing Tab inside LI will add an internal list
*/
tabInsideLiInsertNewList: boolean;
};
}
}
export {};

12
node_modules/jodit/esm/plugins/tab/config.js generated vendored Normal file
View File

@@ -0,0 +1,12 @@
/*!
* 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/tab
*/
import { Config } from "../../config.js";
Config.prototype.tab = {
tabInsideLiInsertNewList: true
};

6
node_modules/jodit/esm/plugins/tab/tab.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";

50
node_modules/jodit/esm/plugins/tab/tab.js generated vendored Normal file
View File

@@ -0,0 +1,50 @@
/*!
* 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 { KEY_TAB } from "../../core/constants.js";
import { watch } from "../../core/decorators/index.js";
import { pluginSystem } from "../../core/global.js";
import { Plugin } from "../../core/plugin/index.js";
import "./config.js";
import { onTabInsideLi } from "./cases/index.js";
class tab extends Plugin {
afterInit(jodit) { }
__onTab(event) {
if (event.key === KEY_TAB && this.__onShift(event.shiftKey)) {
return false;
}
}
__onCommand(command) {
if ((command === 'indent' || command === 'outdent') &&
this.__onShift(command === 'outdent')) {
return false;
}
}
__onShift(shift) {
const res = onTabInsideLi(this.j, shift);
if (res) {
this.j.e.fire('afterTab', shift);
}
return res;
}
beforeDestruct(jodit) { }
}
__decorate([
watch(':keydown.tab')
], tab.prototype, "__onTab", null);
__decorate([
watch(':beforeCommand.tab')
], tab.prototype, "__onCommand", null);
pluginSystem.add('tab', tab);