Update persona image upload to new cropper
This commit is contained in:
parent
45ae8d1060
commit
650755198d
|
@ -3,11 +3,9 @@ import {
|
||||||
characters,
|
characters,
|
||||||
chat,
|
chat,
|
||||||
chat_metadata,
|
chat_metadata,
|
||||||
crop_data,
|
|
||||||
default_avatar,
|
default_avatar,
|
||||||
eventSource,
|
eventSource,
|
||||||
event_types,
|
event_types,
|
||||||
getCropPopup,
|
|
||||||
getRequestHeaders,
|
getRequestHeaders,
|
||||||
getThumbnailUrl,
|
getThumbnailUrl,
|
||||||
name1,
|
name1,
|
||||||
|
@ -24,6 +22,7 @@ import { PAGINATION_TEMPLATE, debounce, delay, download, ensureImageFormatSuppor
|
||||||
import { debounce_timeout } from './constants.js';
|
import { debounce_timeout } from './constants.js';
|
||||||
import { FILTER_TYPES, FilterHelper } from './filters.js';
|
import { FILTER_TYPES, FilterHelper } from './filters.js';
|
||||||
import { selected_group } from './group-chats.js';
|
import { selected_group } from './group-chats.js';
|
||||||
|
import { POPUP_TYPE, Popup } from './popup.js';
|
||||||
|
|
||||||
let savePersonasPage = 0;
|
let savePersonasPage = 0;
|
||||||
const GRID_STORAGE_KEY = 'Personas_GridView';
|
const GRID_STORAGE_KEY = 'Personas_GridView';
|
||||||
|
@ -278,13 +277,15 @@ async function changeUserAvatar(e) {
|
||||||
let url = '/api/avatars/upload';
|
let url = '/api/avatars/upload';
|
||||||
|
|
||||||
if (!power_user.never_resize_avatars) {
|
if (!power_user.never_resize_avatars) {
|
||||||
const confirmation = await callPopup(getCropPopup(dataUrl), 'avatarToCrop', '', { okButton: 'Crop', large: true, wide: true });
|
const dlg = new Popup('Set the crop position of the avatar image', POPUP_TYPE.CROP, '', { cropImage: dataUrl });
|
||||||
if (!confirmation) {
|
const result = await dlg.show();
|
||||||
|
|
||||||
|
if (!result) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (crop_data !== undefined) {
|
if (dlg.cropData !== undefined) {
|
||||||
url += `?crop=${encodeURIComponent(JSON.stringify(crop_data))}`;
|
url += `?crop=${encodeURIComponent(JSON.stringify(dlg.cropData))}`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -210,7 +210,7 @@ export class Popup {
|
||||||
autoCropArea: 1,
|
autoCropArea: 1,
|
||||||
viewMode: 2,
|
viewMode: 2,
|
||||||
rotatable: false,
|
rotatable: false,
|
||||||
crop: function (event) {
|
crop: (event) => {
|
||||||
this.cropData = event.detail;
|
this.cropData = event.detail;
|
||||||
this.cropData.want_resize = !power_user.never_resize_avatars;
|
this.cropData.want_resize = !power_user.never_resize_avatars;
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue