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,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/image-properties
*/
import type { IJodit } from "../../../types/index";
import type { ImagePropertiesState } from "../interface";
/**
* Open image editor dialog
* @private
*/
export declare function openImageEditorDialog(j: IJodit, state: ImagePropertiesState): void;

View File

@@ -0,0 +1,52 @@
/*!
* 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 { isString } from "../../../core/helpers/checker/is-string.js";
import { attr } from "../../../core/helpers/utils/attr.js";
import { openImageEditor } from "../../../modules/image-editor/image-editor.js";
/**
* Open image editor dialog
* @private
*/
export function openImageEditorDialog(j, state) {
const url = attr(state.image, 'src') || '', a = j.c.element('a'), loadExternal = () => {
if (a.host !== location.host) {
j.confirm('You can only edit your own images. Download this image on the host?', yes => {
if (yes && j.uploader) {
j.uploader.uploadRemoteImage(a.href.toString(), resp => {
j.alert('The image has been successfully uploaded to the host!', () => {
if (isString(resp.newfilename)) {
state.values.imageSrc =
resp.baseurl +
resp.newfilename;
}
});
}, error => {
j.alert('There was an error loading %s', error.message);
});
}
});
return;
}
};
a.href = url;
j.filebrowser.dataProvider
.getPathByUrl(a.href.toString())
.then(resp => {
openImageEditor.call(j.filebrowser, a.href, resp.name, resp.path, resp.source, () => {
const timestamp = new Date().getTime();
state.values.imageSrc =
url +
(url.indexOf('?') !== -1 ? '' : '?') +
'&_tmp=' +
timestamp.toString();
}, error => {
j.alert(error.message);
});
})
.catch(error => {
j.alert(error.message, loadExternal);
});
}

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/image-properties
*/
import type { IDialog, IJodit } from "../../../types/index";
import type { ImagePropertiesState } from "../interface";
/** @private */
export declare function openImagePopup(j: IJodit, dialog: IDialog, state: ImagePropertiesState, button: HTMLElement): void;

View File

@@ -0,0 +1,34 @@
/*!
* 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 { isArray } from "../../../core/helpers/checker/is-array.js";
import { position } from "../../../core/helpers/size/position.js";
import { Popup } from "../../../core/ui/popup/popup.js";
import { FileSelectorWidget } from "../../../modules/widget/file-selector/file-selector.js";
/** @private */
export function openImagePopup(j, dialog, state, button) {
const popup = new Popup(dialog);
const closePopup = () => {
popup.close();
popup.destruct();
};
popup
.setContent(FileSelectorWidget(j, {
upload: (data) => {
if (data.files && data.files.length) {
state.values.imageSrc =
data.baseurl + data.files[0];
}
closePopup();
},
filebrowser: async (data) => {
if (data && isArray(data.files) && data.files.length) {
state.values.imageSrc = data.files[0];
closePopup();
}
}
}, state.image, closePopup))
.open(() => position(button));
}

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
*/
/** @private */
export declare const normalSizeFromString: (value: string | number) => string | number;
/** @private */
export declare const normalSizeToString: (value: string | number) => string;

View File

@@ -0,0 +1,24 @@
/*!
* 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/image-properties
*/
import { isNumber } from "../../../core/helpers/checker/is-number.js";
import { trim } from "../../../core/helpers/string/trim.js";
/** @private */
export const normalSizeFromString = (value) => {
return /^[-+]?[0-9.]+(px)?$/.test(value.toString())
? parseFloat(value.toString())
: value;
};
/** @private */
export const normalSizeToString = (value) => {
if (isNumber(value)) {
return value ? value + 'px' : value.toString();
}
value = trim(value);
return /^[0-9]+$/.test(value) ? value + 'px' : value;
};