mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-17 06:16:59 +08:00
fix: uniform workspace name length limit, fixed #810
This commit is contained in:
@@ -57,8 +57,10 @@ export const CreateWorkspaceModal = ({ open, onClose }: ModalProps) => {
|
|||||||
<Input
|
<Input
|
||||||
onKeyDown={handleKeyDown}
|
onKeyDown={handleKeyDown}
|
||||||
placeholder={t('Set a Workspace name')}
|
placeholder={t('Set a Workspace name')}
|
||||||
|
maxLength={15}
|
||||||
|
minLength={0}
|
||||||
onChange={value => {
|
onChange={value => {
|
||||||
setWorkspaceName(value.slice(0, 15));
|
setWorkspaceName(value);
|
||||||
}}
|
}}
|
||||||
></Input>
|
></Input>
|
||||||
<Button
|
<Button
|
||||||
|
|||||||
@@ -85,8 +85,8 @@ export const GeneralPage = ({ workspace }: { workspace: WorkspaceUnit }) => {
|
|||||||
height={32}
|
height={32}
|
||||||
value={workspaceName}
|
value={workspaceName}
|
||||||
placeholder={t('Workspace Name')}
|
placeholder={t('Workspace Name')}
|
||||||
maxLength={14}
|
maxLength={15}
|
||||||
minLength={1}
|
minLength={0}
|
||||||
disabled={!isOwner}
|
disabled={!isOwner}
|
||||||
onChange={handleChangeWorkSpaceName}
|
onChange={handleChangeWorkSpaceName}
|
||||||
></StyledInput>
|
></StyledInput>
|
||||||
|
|||||||
@@ -38,8 +38,9 @@ export const Input = (props: inputProps) => {
|
|||||||
if (
|
if (
|
||||||
(maxLength && e.target.value.length > maxLength) ||
|
(maxLength && e.target.value.length > maxLength) ||
|
||||||
(minLength && e.target.value.length < minLength)
|
(minLength && e.target.value.length < minLength)
|
||||||
)
|
) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
setValue(e.target.value);
|
setValue(e.target.value);
|
||||||
onChange && onChange(e.target.value);
|
onChange && onChange(e.target.value);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user