allow space in textfields

This commit is contained in:
刘浩远 2020-06-21 14:37:49 +08:00
parent 5bb22c2ed6
commit 02c13cffcc
6 changed files with 34 additions and 23 deletions

29
dist/styles.css vendored
View File

@ -154,6 +154,9 @@ nav .progress {
text-align: center; text-align: center;
vertical-align: middle; vertical-align: middle;
} }
body.darwin .btn-group .seperator {
line-height: 32px;
}
.btn-group .seperator::before { .btn-group .seperator::before {
content: "|"; content: "|";
} }
@ -181,12 +184,15 @@ nav.menu-on .btn-group .btn.system, nav.hide-btns .btn-group .btn.system {
nav.menu-on .btn-group .btn.system, nav.item-on .btn-group .btn.system { nav.menu-on .btn-group .btn.system, nav.item-on .btn-group .btn.system {
color: var(--white); color: var(--white);
} }
.btn-group .btn:hover { .btn-group .btn:hover, .ms-Nav-compositeLink:hover {
background-color: #0001; background-color: #0001;
} }
.btn-group .btn:active { .btn-group .btn:active, .ms-Nav-compositeLink:active {
background-color: #0002; background-color: #0002;
} }
.ms-Nav-compositeLink:hover .ms-Nav-link {
background: none;
}
.btn-group .btn.disabled, .btn-group .btn.fetching { .btn-group .btn.disabled, .btn-group .btn.fetching {
background-color: unset !important; background-color: unset !important;
color: var(--neutralSecondaryAlt); color: var(--neutralSecondaryAlt);
@ -661,11 +667,13 @@ img.favicon {
cursor: pointer; cursor: pointer;
animation-fill-mode: none; animation-fill-mode: none;
} }
.card:hover, .card:focus { .card:focus, .list-card:focus {
box-shadow: #0006 0px 5px 40px;
outline: none; outline: none;
} }
.card:focus::after, .list-card:focus::after { .card:hover, .ms-Fabric--isFocusVisible .card:focus {
box-shadow: #0006 0px 5px 40px;
}
.ms-Fabric--isFocusVisible .card:focus::after, .ms-Fabric--isFocusVisible .list-card:focus::after {
content: ""; content: "";
position: absolute; position: absolute;
top: 2px; top: 2px;
@ -705,7 +713,9 @@ img.favicon {
transition: transform ease-out .12s; transition: transform ease-out .12s;
} }
.card.transform:hover img.head, .card.transform:hover p, .card.transform:hover h3, .card.transform:hover img.head, .card.transform:hover p, .card.transform:hover h3,
.card.transform:focus img.head, .card.transform:focus p, .card.transform:focus h3 { .ms-Fabric--isFocusVisible .card.transform:focus img.head,
.ms-Fabric--isFocusVisible .card.transform:focus p,
.ms-Fabric--isFocusVisible .card.transform:focus h3 {
transform: translateY(-144px); transform: translateY(-144px);
} }
.card h3.title { .card h3.title {
@ -759,9 +769,8 @@ img.favicon {
cursor: pointer; cursor: pointer;
box-shadow: #0000 0px 5px 15px; box-shadow: #0000 0px 5px 15px;
} }
.list-card:hover, .list-card:focus { .list-card:hover, .ms-Fabric--isFocusVisible .list-card:focus {
box-shadow: #0004 0px 5px 15px; box-shadow: #0004 0px 5px 15px;
outline: none;
} }
.list-card:active { .list-card:active {
box-shadow: #0000 0px 5px 15px, inset #0004 0px 0px 15px; box-shadow: #0000 0px 5px 15px, inset #0004 0px 0px 15px;
@ -800,10 +809,10 @@ img.favicon {
.ms-Button--commandBar.active .ms-Button-icon { .ms-Button--commandBar.active .ms-Button-icon {
color: #c7e0f4; color: #c7e0f4;
} }
.btn-group .btn:hover { .btn-group .btn:hover, .ms-Nav-compositeLink:hover {
background-color: #fff1; background-color: #fff1;
} }
.btn-group .btn:active { .btn-group .btn:active, .ms-Nav-compositeLink:active {
background-color: #fff2; background-color: #fff2;
} }
.settings .loading { .settings .loading {

View File

@ -17,7 +17,6 @@ class DefaultCard extends Card {
className={this.className()} className={this.className()}
onClick={this.onClick} onClick={this.onClick}
onMouseUp={this.onMouseUp} onMouseUp={this.onMouseUp}
onMouseDown={event => event.preventDefault()}
onKeyDown={this.onKeyDown} onKeyDown={this.onKeyDown}
data-iid={this.props.item._id} data-iid={this.props.item._id}
data-is-focusable> data-is-focusable>

View File

@ -16,7 +16,6 @@ class ListCard extends Card {
className={this.className()} className={this.className()}
onClick={this.onClick} onClick={this.onClick}
onMouseUp={this.onMouseUp} onMouseUp={this.onMouseUp}
onMouseDown={event => event.preventDefault()}
onKeyDown={this.onKeyDown} onKeyDown={this.onKeyDown}
data-iid={this.props.item._id} data-iid={this.props.item._id}
data-is-focusable> data-is-focusable>

View File

@ -91,8 +91,10 @@ export class Menu extends React.Component<MenuProps> {
let [type, index] = item.key.split("-") let [type, index] = item.key.split("-")
if (type === "s") { if (type === "s") {
sids = [parseInt(index)] sids = [parseInt(index)]
} else { } else if (type === "g") {
sids = this.props.groups[parseInt(index)].sids sids = this.props.groups[parseInt(index)].sids
} else {
return
} }
this.props.groupContextMenu(sids, event) this.props.groupContextMenu(sids, event)
} }

View File

@ -214,12 +214,13 @@ class GroupsTab extends React.Component<GroupsTabProps, GroupsTabState> {
handleInputChange = (event) => { handleInputChange = (event) => {
const name: string = event.target.name const name: string = event.target.name
this.setState({[name]: event.target.value.trim()}) this.setState({[name]: event.target.value})
} }
createGroup = (event: React.FormEvent) => { createGroup = (event: React.FormEvent) => {
event.preventDefault() event.preventDefault()
if (this.state.newGroupName.length > 0) this.props.createGroup(this.state.newGroupName) let trimmed = this.state.newGroupName.trim()
if (trimmed.length > 0) this.props.createGroup(trimmed)
} }
addToGroup = () => { addToGroup = () => {
@ -239,7 +240,7 @@ class GroupsTab extends React.Component<GroupsTabProps, GroupsTabState> {
updateGroupName = () => { updateGroupName = () => {
let group = this.state.selectedGroup let group = this.state.selectedGroup
group = { ...group, name: this.state.editGroupName } group = { ...group, name: this.state.editGroupName.trim() }
this.props.updateGroup(group) this.props.updateGroup(group)
} }
@ -292,7 +293,7 @@ class GroupsTab extends React.Component<GroupsTabProps, GroupsTabState> {
</Stack.Item> </Stack.Item>
<Stack.Item> <Stack.Item>
<PrimaryButton <PrimaryButton
disabled={this.state.newGroupName.length == 0} disabled={this.state.newGroupName.trim().length == 0}
type="sumbit" type="sumbit"
text={intl.get("create")} /> text={intl.get("create")} />
</Stack.Item> </Stack.Item>
@ -325,7 +326,7 @@ class GroupsTab extends React.Component<GroupsTabProps, GroupsTabState> {
</Stack.Item> </Stack.Item>
<Stack.Item> <Stack.Item>
<DefaultButton <DefaultButton
disabled={this.state.editGroupName.length == 0} disabled={this.state.editGroupName.trim().length == 0}
onClick={this.updateGroupName} onClick={this.updateGroupName}
text={intl.get("groups.editName")} /> text={intl.get("groups.editName")} />
</Stack.Item> </Stack.Item>

View File

@ -101,12 +101,13 @@ class SourcesTab extends React.Component<SourcesTabProps, SourcesTabState> {
handleInputChange = (event) => { handleInputChange = (event) => {
const name: string = event.target.name const name: string = event.target.name
this.setState({[name]: event.target.value.trim()}) this.setState({[name]: event.target.value})
} }
addSource = (event: React.FormEvent) => { addSource = (event: React.FormEvent) => {
event.preventDefault() event.preventDefault()
if (urlTest(this.state.newUrl)) this.props.addSource(this.state.newUrl) let trimmed = this.state.newUrl.trim()
if (urlTest(trimmed)) this.props.addSource(trimmed)
} }
onOpenTargetChange = (_, option: IChoiceGroupOption) => { onOpenTargetChange = (_, option: IChoiceGroupOption) => {
@ -142,7 +143,7 @@ class SourcesTab extends React.Component<SourcesTabProps, SourcesTabState> {
</Stack.Item> </Stack.Item>
<Stack.Item> <Stack.Item>
<PrimaryButton <PrimaryButton
disabled={!urlTest(this.state.newUrl)} disabled={!urlTest(this.state.newUrl.trim())}
type="submit" type="submit"
text={intl.get("add")} /> text={intl.get("add")} />
</Stack.Item> </Stack.Item>
@ -171,8 +172,8 @@ class SourcesTab extends React.Component<SourcesTabProps, SourcesTabState> {
</Stack.Item> </Stack.Item>
<Stack.Item> <Stack.Item>
<DefaultButton <DefaultButton
disabled={this.state.newSourceName.length == 0} disabled={this.state.newSourceName.trim().length == 0}
onClick={() => this.props.updateSourceName(this.state.selectedSource, this.state.newSourceName)} onClick={() => this.props.updateSourceName(this.state.selectedSource, this.state.newSourceName.trim())}
text={intl.get("sources.editName")} /> text={intl.get("sources.editName")} />
</Stack.Item> </Stack.Item>
</Stack> </Stack>