Add cropping support when modifying the user/org/repo avatar (#33498)
Fixed #33321 --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
parent
943cc4f989
commit
40426addfa
11 changed files with 35 additions and 28 deletions
|
@ -1,17 +1,10 @@
|
|||
import {hideElem, showElem} from '../utils/dom.ts';
|
||||
import {initCompCropper} from './comp/Cropper.ts';
|
||||
|
||||
function initUserSettingsAvatarCropper() {
|
||||
const fileInput = document.querySelector<HTMLInputElement>('#new-avatar');
|
||||
const container = document.querySelector<HTMLElement>('.user.settings.profile .cropper-panel');
|
||||
const imageSource = container.querySelector<HTMLImageElement>('.cropper-source');
|
||||
initCompCropper({container, fileInput, imageSource});
|
||||
}
|
||||
import {hideElem, queryElems, showElem} from '../utils/dom.ts';
|
||||
import {initAvatarUploaderWithCropper} from './comp/Cropper.ts';
|
||||
|
||||
export function initUserSettings() {
|
||||
if (!document.querySelector('.user.settings.profile')) return;
|
||||
|
||||
initUserSettingsAvatarCropper();
|
||||
queryElems(document, '.avatar-file-with-cropper', initAvatarUploaderWithCropper);
|
||||
|
||||
const usernameInput = document.querySelector<HTMLInputElement>('#username');
|
||||
if (!usernameInput) return;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue