diff --git a/src/pages/workspace/draft/Draft.tsx b/src/pages/workspace/draft/Draft.tsx index 4c93601..c7a2c1e 100644 --- a/src/pages/workspace/draft/Draft.tsx +++ b/src/pages/workspace/draft/Draft.tsx @@ -115,9 +115,16 @@ export default function Draft(props: IProps) { { + if (e.key === 'Enter') e.currentTarget.blur(); + e.stopPropagation(); + }} onFocus={e => { currentName.current = e.target.value; + e.currentTarget.select(); }} + onClick={e => e.stopPropagation()} onBlur={async e => { if (e.target.value === currentName.current) return; item.name = e.target.value; diff --git a/src/pages/workspace/draft/styles.module.less b/src/pages/workspace/draft/styles.module.less index 27dd7e6..b5a0010 100644 --- a/src/pages/workspace/draft/styles.module.less +++ b/src/pages/workspace/draft/styles.module.less @@ -18,10 +18,32 @@ .name { margin-top: 10px; - border: none; + border: 1px solid transparent; width: 100%; background: transparent; color: var(--theme-text); + cursor: text; + border-radius: 6px; + padding: 4px 6px; + font-size: 14px; + line-height: 1.4; + transition: background 0.2s, border-color 0.2s; + + &:hover { + background: var(--theme-wateritem); + border-color: var(--theme-main); + } + + &:focus { + outline: none; + background: var(--theme-wateritem); + border-color: var(--theme-main); + } + + &::placeholder { + color: var(--theme-text); + opacity: 0.5; + } } .pic {