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

61
node_modules/jodit/esm/plugins/link/config.d.ts generated vendored Normal file
View File

@@ -0,0 +1,61 @@
/*!
* 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/link
*/
import type { IJodit, IUIForm, IUIOption } from "../../types/index";
declare module 'jodit/config' {
interface Config {
link: {
/**
* Template for the link dialog form
*/
formTemplate: (editor: IJodit) => string | HTMLElement | IUIForm;
formClassName?: string;
/**
* Follow link address after dblclick
*/
followOnDblClick: boolean;
/**
* Replace inserted youtube/vimeo link to `iframe`
*/
processVideoLink: boolean;
/**
* Wrap inserted link
*/
processPastedLink: boolean;
/**
* Show `no follow` checkbox in link dialog.
*/
noFollowCheckbox: boolean;
/**
* Show `Open in new tab` checkbox in link dialog.
*/
openInNewTabCheckbox: boolean;
/**
* Use an input text to ask the classname or a select or not ask
*/
modeClassName: 'input' | 'select';
/**
* Allow multiple choises (to use with modeClassName="select")
*/
selectMultipleClassName: boolean;
/**
* The size of the select (to use with modeClassName="select")
*/
selectSizeClassName?: number;
/**
* The list of the option for the select (to use with modeClassName="select")
*/
selectOptionsClassName: IUIOption[];
hotkeys: string[];
/**
* Prevent navigation to the link if it is readonly. Default: true
*/
preventReadOnlyNavigation: boolean;
};
}
}

48
node_modules/jodit/esm/plugins/link/config.js generated vendored Normal file
View File

@@ -0,0 +1,48 @@
/*!
* 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 { Icon } from "../../core/ui/icon.js";
import { Config } from "../../config.js";
import linkIcon from "./icons/link.svg.js";
import unlinkIcon from "./icons/unlink.svg.js";
import { formTemplate } from "./template.js";
Config.prototype.link = {
formTemplate,
followOnDblClick: false,
processVideoLink: true,
processPastedLink: true,
noFollowCheckbox: true,
openInNewTabCheckbox: true,
modeClassName: 'input',
selectMultipleClassName: true,
preventReadOnlyNavigation: true,
selectSizeClassName: 3,
selectOptionsClassName: [],
hotkeys: ['ctrl+k', 'cmd+k']
};
Icon.set('link', linkIcon).set('unlink', unlinkIcon);
Config.prototype.controls.unlink = {
exec: (editor, current) => {
const anchor = Dom.closest(current, 'a', editor.editor);
if (anchor) {
Dom.unwrap(anchor);
}
editor.synchronizeValues();
editor.e.fire('hidePopup');
},
tooltip: 'Unlink'
};
Config.prototype.controls.link = {
isActive: (editor) => {
const current = editor.s.current();
return Boolean(current && Dom.closest(current, 'a', editor.editor));
},
popup: (editor, current, close) => {
return editor.e.fire('generateLinkForm.link', current, close);
},
tags: ['a'],
tooltip: 'Insert link'
};

View File

@@ -0,0 +1 @@
export default "<svg xmlns='http://www.w3.org/2000/svg' viewBox=\"0 0 1792 1792\"> <path d=\"M1520 1216q0-40-28-68l-208-208q-28-28-68-28-42 0-72 32 3 3 19 18.5t21.5 21.5 15 19 13 25.5 3.5 27.5q0 40-28 68t-68 28q-15 0-27.5-3.5t-25.5-13-19-15-21.5-21.5-18.5-19q-33 31-33 73 0 40 28 68l206 207q27 27 68 27 40 0 68-26l147-146q28-28 28-67zm-703-705q0-40-28-68l-206-207q-28-28-68-28-39 0-68 27l-147 146q-28 28-28 67 0 40 28 68l208 208q27 27 68 27 42 0 72-31-3-3-19-18.5t-21.5-21.5-15-19-13-25.5-3.5-27.5q0-40 28-68t68-28q15 0 27.5 3.5t25.5 13 19 15 21.5 21.5 18.5 19q33-31 33-73zm895 705q0 120-85 203l-147 146q-83 83-203 83-121 0-204-85l-206-207q-83-83-83-203 0-123 88-209l-88-88q-86 88-208 88-120 0-204-84l-208-208q-84-84-84-204t85-203l147-146q83-83 203-83 121 0 204 85l206 207q83 83 83 203 0 123-88 209l88 88q86-88 208-88 120 0 204 84l208 208q84 84 84 204z\"/> </svg> ";

View File

@@ -0,0 +1 @@
export default "<svg xmlns='http://www.w3.org/2000/svg' viewBox=\"0 0 1792 1792\"> <path d=\"M503 1271l-256 256q-10 9-23 9-12 0-23-9-9-10-9-23t9-23l256-256q10-9 23-9t23 9q9 10 9 23t-9 23zm169 41v320q0 14-9 23t-23 9-23-9-9-23v-320q0-14 9-23t23-9 23 9 9 23zm-224-224q0 14-9 23t-23 9h-320q-14 0-23-9t-9-23 9-23 23-9h320q14 0 23 9t9 23zm1264 128q0 120-85 203l-147 146q-83 83-203 83-121 0-204-85l-334-335q-21-21-42-56l239-18 273 274q27 27 68 27.5t68-26.5l147-146q28-28 28-67 0-40-28-68l-274-275 18-239q35 21 56 42l336 336q84 86 84 204zm-617-724l-239 18-273-274q-28-28-68-28-39 0-68 27l-147 146q-28 28-28 67 0 40 28 68l274 274-18 240q-35-21-56-42l-336-336q-84-86-84-204 0-120 85-203l147-146q83-83 203-83 121 0 204 85l334 335q21 21 42 56zm633 84q0 14-9 23t-23 9h-320q-14 0-23-9t-9-23 9-23 23-9h320q14 0 23 9t9 23zm-544-544v320q0 14-9 23t-23 9-23-9-9-23v-320q0-14 9-23t23-9 23 9 9 23zm407 151l-256 256q-11 9-23 9t-23-9q-9-10-9-23t9-23l256-256q10-9 23-9t23 9q9 10 9 23t-9 23z\"/> </svg> ";

28
node_modules/jodit/esm/plugins/link/link.d.ts generated vendored Normal file
View File

@@ -0,0 +1,28 @@
/*!
* 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:plugins/link/README.md]]
* @packageDocumentation
* @module plugins/link
*/
import type { IJodit } from "../../types/index";
import { Plugin } from "../../core/plugin/index";
import "./config";
/**
* Process link. Insert, dblclick or remove format
*/
export declare class link extends Plugin {
/** @override */
buttons: Plugin['buttons'];
/** @override */
protected afterInit(jodit: IJodit): void;
private __onDblClickOnLink;
private onProcessPasteLink;
private __generateForm;
/** @override */
protected beforeDestruct(jodit: IJodit): void;
private __onClickReadOnlyLink;
}

353
node_modules/jodit/esm/plugins/link/link.js generated vendored Normal file
View File

@@ -0,0 +1,353 @@
/*!
* 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 { autobind } from "../../core/decorators/index.js";
import { Dom } from "../../core/dom/index.js";
import { pluginSystem } from "../../core/global.js";
import { attr, call, convertMediaUrlToVideoEmbed, isString, isURL, refs, stripTags } from "../../core/helpers/index.js";
import { Plugin } from "../../core/plugin/index.js";
import "./config.js";
/**
* Process link. Insert, dblclick or remove format
*/
export class link extends Plugin {
constructor() {
super(...arguments);
/** @override */
this.buttons = [
{
name: 'link',
group: 'insert'
}
];
}
/** @override */
afterInit(jodit) {
if (jodit.o.link.followOnDblClick) {
jodit.e.on('dblclick.link', this.__onDblClickOnLink);
}
jodit.e.on(jodit.editor, 'click.link', this.__onClickReadOnlyLink);
if (jodit.o.link.processPastedLink) {
jodit.e.on('processPaste.link', this.onProcessPasteLink);
}
jodit.e.on('generateLinkForm.link', this.__generateForm);
jodit.registerCommand('openLinkDialog', {
exec: () => {
const dialog = jodit.dlg({
resizable: false
});
const htmlForm = this.__generateForm(jodit.s.current(), () => {
dialog.close();
});
htmlForm.container.classList.add('jodit-dialog_alert');
dialog.setContent(htmlForm);
dialog.open();
jodit.async.requestIdleCallback(() => {
const { url_input } = refs(htmlForm.container);
url_input === null || url_input === void 0 ? void 0 : url_input.focus();
});
},
hotkeys: jodit.o.link.hotkeys
});
}
__onDblClickOnLink(e) {
if (!Dom.isTag(e.target, 'a')) {
return;
}
const href = attr(e.target, 'href');
if (href) {
location.href = href;
e.preventDefault();
}
}
onProcessPasteLink(ignore, html) {
var _a, _b, _c, _d;
const { jodit } = this;
if (!isURL(html) || !jodit.o.link.processPastedLink) {
return;
}
jodit.e.stopPropagation('processPaste');
if (jodit.o.link.processVideoLink) {
const embed = call((_b = (_a = jodit.o.video) === null || _a === void 0 ? void 0 : _a.parseUrlToVideoEmbed) !== null && _b !== void 0 ? _b : convertMediaUrlToVideoEmbed, html, {
width: (_c = jodit.o.video) === null || _c === void 0 ? void 0 : _c.defaultWidth,
height: (_d = jodit.o.video) === null || _d === void 0 ? void 0 : _d.defaultHeight
});
if (embed !== html) {
return jodit.createInside.fromHTML(embed);
}
}
if (jodit.s.isCollapsed()) {
const a = jodit.createInside.element('a');
a.setAttribute('href', html);
a.textContent = html;
jodit.e.fire('applyLink', jodit, a, null);
return a;
}
jodit.s.commitStyle({
element: 'a',
attributes: {
href: html
}
});
return true;
}
__generateForm(current, close) {
const { jodit } = this;
const i18n = jodit.i18n.bind(jodit), { openInNewTabCheckbox, noFollowCheckbox, formTemplate, formClassName, modeClassName } = jodit.o.link;
const html = formTemplate(jodit);
const form = isString(html)
? jodit.c.fromHTML(html, {
target_checkbox_box: openInNewTabCheckbox,
nofollow_checkbox_box: noFollowCheckbox
})
: html;
const htmlForm = Dom.isElement(form) ? form : form.container;
const elements = refs(htmlForm);
const { insert, unlink, content_input_box } = elements;
const { target_checkbox, nofollow_checkbox, url_input } = elements;
const currentElement = current;
const isImageContent = Dom.isImage(currentElement);
let { content_input } = elements;
const { className_input } = elements, { className_select } = elements;
if (!content_input) {
content_input = jodit.c.element('input', {
type: 'hidden',
ref: 'content_input'
});
}
if (formClassName) {
htmlForm.classList.add(formClassName);
}
if (isImageContent) {
Dom.hide(content_input_box);
}
let link;
const getSelectionText = () => link
? link.innerText
: stripTags(jodit.s.range.cloneContents(), jodit.ed);
if (current && Dom.closest(current, 'a', jodit.editor)) {
link = Dom.closest(current, 'a', jodit.editor);
}
else {
link = false;
}
if (!isImageContent && current) {
content_input.value = getSelectionText();
}
if (link) {
url_input.value = attr(link, 'href') || '';
if (modeClassName) {
readClassnames(modeClassName, className_input, link, className_select);
}
if (openInNewTabCheckbox && target_checkbox) {
target_checkbox.checked = attr(link, 'target') === '_blank';
}
if (noFollowCheckbox && nofollow_checkbox) {
nofollow_checkbox.checked = attr(link, 'rel') === 'nofollow';
}
insert.textContent = i18n('Update');
}
else {
Dom.hide(unlink);
}
jodit.editor.normalize();
const snapshot = jodit.history.snapshot.make();
if (unlink) {
jodit.e.on(unlink, 'click', (e) => {
jodit.s.restore();
jodit.history.snapshot.restore(snapshot);
if (link) {
Dom.unwrap(link);
}
jodit.synchronizeValues();
close();
e.preventDefault();
});
}
const onSubmit = () => {
if (!url_input.value.trim().length) {
url_input.focus();
url_input.classList.add('jodit_error');
return false;
}
let links;
jodit.s.restore();
jodit.s.removeMarkers();
jodit.editor.normalize();
jodit.history.snapshot.restore(snapshot);
const textWasChanged = getSelectionText() !== content_input.value.trim();
const ci = jodit.createInside;
if (!link || !Dom.isOrContains(jodit.editor, link)) {
if (!jodit.s.isCollapsed()) {
const node = jodit.s.current();
if (Dom.isTag(node, 'img')) {
links = [Dom.wrap(node, 'a', ci)];
}
else {
links = jodit.s.wrapInTag('a');
}
}
else {
const a = ci.element('a');
jodit.s.insertNode(a, false, false);
links = [a];
}
links.forEach(link => jodit.s.select(link));
}
else {
links = [link];
}
links.forEach(a => {
attr(a, 'href', url_input.value);
writeClasses(modeClassName, className_input, className_select, a);
if (!isImageContent) {
writeImage(a, content_input, textWasChanged, url_input);
}
if (openInNewTabCheckbox && target_checkbox) {
attr(a, 'target', target_checkbox.checked ? '_blank' : null);
}
if (noFollowCheckbox && nofollow_checkbox) {
attr(a, 'rel', nofollow_checkbox.checked ? 'nofollow' : null);
}
jodit.e.fire('applyLink', jodit, a, form);
});
jodit.synchronizeValues();
close();
return false;
};
if (Dom.isElement(form)) {
jodit.e.on(form, 'submit', (event) => {
event.preventDefault();
event.stopImmediatePropagation();
onSubmit();
return false;
});
}
else {
form.onSubmit(onSubmit);
}
return form;
}
/** @override */
beforeDestruct(jodit) {
jodit.e
.off('generateLinkForm.link', this.__generateForm)
.off('dblclick.link', this.__onDblClickOnLink)
.off(jodit.editor, 'click.link', this.__onClickReadOnlyLink)
.off('processPaste.link', this.onProcessPasteLink);
}
__onClickReadOnlyLink(e) {
const { jodit } = this;
if (jodit.o.readonly &&
jodit.o.link.preventReadOnlyNavigation &&
Dom.isTag(e.target, 'a')) {
e.preventDefault();
}
}
}
__decorate([
autobind
], link.prototype, "__onDblClickOnLink", null);
__decorate([
autobind
], link.prototype, "onProcessPasteLink", null);
__decorate([
autobind
], link.prototype, "__generateForm", null);
__decorate([
autobind
], link.prototype, "__onClickReadOnlyLink", null);
pluginSystem.add('link', link);
function writeClasses(modeClassName, className_input, className_select, a) {
var _a;
if (modeClassName && (className_input !== null && className_input !== void 0 ? className_input : className_select)) {
if (modeClassName === 'input') {
if (className_input.value === '' && a.hasAttribute('class')) {
attr(a, 'class', null);
}
if (className_input.value !== '') {
attr(a, 'class', className_input.value);
}
}
else if (modeClassName === 'select') {
if (a.hasAttribute('class')) {
attr(a, 'class', null);
}
for (let i = 0; i < className_select.selectedOptions.length; i++) {
const className = (_a = className_select.selectedOptions.item(i)) === null || _a === void 0 ? void 0 : _a.value;
if (className) {
className
.split(/\s+/)
.filter(cn => cn.trim().length > 0)
.forEach(cn => {
a.classList.add(cn);
});
}
}
}
}
}
function readClassnames(modeClassName, className_input, link, className_select) {
switch (modeClassName) {
case 'input':
if (className_input) {
className_input.value = attr(link, 'class') || '';
}
break;
case 'select':
if (className_select) {
for (let i = 0; i < className_select.selectedOptions.length; i++) {
const option = className_select.options.item(i);
if (option) {
option.selected = false;
}
}
const classNames = attr(link, 'class') || '';
classNames
.split(/\s+/)
.filter(cn => cn.trim().length > 0)
.forEach(className => {
if (className) {
for (let i = 0; i < className_select.options.length; i++) {
const option = className_select.options.item(i);
if ((option === null || option === void 0 ? void 0 : option.value) &&
option.value
.split(/\s+/)
.map(cn => cn.trim())
.includes(className)) {
option.selected = true;
}
}
}
});
}
break;
}
}
function writeImage(a, content_input, textWasChanged, url_input) {
let newContent = a.textContent;
if (content_input.value.trim().length) {
if (textWasChanged) {
newContent = content_input.value;
}
}
else {
newContent = url_input.value;
}
const content = a.textContent;
if (newContent !== content) {
a.textContent = newContent;
}
}

10
node_modules/jodit/esm/plugins/link/template.d.ts generated vendored Normal file
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/link
*/
import type { IJodit, IUIForm } from "../../types/index";
export declare const formTemplate: (editor: IJodit) => IUIForm;

84
node_modules/jodit/esm/plugins/link/template.js generated vendored Normal file
View File

@@ -0,0 +1,84 @@
/*!
* 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 { UIButton } from "../../core/ui/button/index.js";
import { UIBlock, UICheckbox, UIForm, UIInput, UISelect } from "../../core/ui/form/index.js";
export const formTemplate = (editor) => {
const { openInNewTabCheckbox, noFollowCheckbox, modeClassName, selectSizeClassName, selectMultipleClassName, selectOptionsClassName } = editor.o.link;
return new UIForm(editor, [
new UIBlock(editor, [
new UIInput(editor, {
name: 'url',
type: 'text',
ref: 'url_input',
label: 'URL',
placeholder: 'http://',
required: true
})
]),
new UIBlock(editor, [
new UIInput(editor, {
name: 'content',
ref: 'content_input',
label: 'Text'
})
], {
ref: 'content_input_box'
}),
modeClassName
? new UIBlock(editor, [
(() => {
if (modeClassName === 'input') {
return new UIInput(editor, {
name: 'className',
ref: 'className_input',
label: 'Class name'
});
}
if (modeClassName === 'select') {
return new UISelect(editor, {
name: 'className',
ref: 'className_select',
label: 'Class name',
size: selectSizeClassName,
multiple: selectMultipleClassName,
options: selectOptionsClassName
});
}
return null;
})()
])
: null,
openInNewTabCheckbox
? new UICheckbox(editor, {
name: 'target',
ref: 'target_checkbox',
label: 'Open in new tab'
})
: null,
noFollowCheckbox
? new UICheckbox(editor, {
name: 'nofollow',
ref: 'nofollow_checkbox',
label: 'No follow'
})
: null,
new UIBlock(editor, [
new UIButton(editor, {
name: 'unlink',
variant: 'default',
text: 'Unlink'
}),
new UIButton(editor, {
name: 'insert',
type: 'submit',
variant: 'primary',
text: 'Insert'
})
], {
align: 'full'
})
]);
};