Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
baas-ide
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guxukai
baas-ide
Commits
4b6f9282
Commit
4b6f9282
authored
Sep 23, 2021
by
ioedeveloper
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed rename bug
parent
4ba22378
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
1 deletion
+10
-1
file-label.tsx
libs/remix-ui/workspace/src/lib/components/file-label.tsx
+8
-1
index.ts
libs/remix-ui/workspace/src/lib/utils/index.ts
+2
-0
No files found.
libs/remix-ui/workspace/src/lib/components/file-label.tsx
View file @
4b6f9282
// eslint-disable-next-line @typescript-eslint/no-unused-vars
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import
React
,
{
useEffect
,
useRef
}
from
'react'
import
React
,
{
useEffect
,
useRef
,
useState
}
from
'react'
import
{
FileType
}
from
'../types'
import
{
FileType
}
from
'../types'
export
interface
FileLabelProps
{
export
interface
FileLabelProps
{
...
@@ -17,6 +17,7 @@ export const FileLabel = (props: FileLabelProps) => {
...
@@ -17,6 +17,7 @@ export const FileLabel = (props: FileLabelProps) => {
const
{
file
,
focusEdit
,
editModeOff
}
=
props
const
{
file
,
focusEdit
,
editModeOff
}
=
props
const
isEditable
=
focusEdit
.
element
===
file
.
path
const
isEditable
=
focusEdit
.
element
===
file
.
path
const
labelRef
=
useRef
(
null
)
const
labelRef
=
useRef
(
null
)
const
[
defaultValue
,
setDefaultValue
]
=
useState
<
string
>
(
null
)
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
isEditable
)
{
if
(
isEditable
)
{
...
@@ -26,16 +27,22 @@ export const FileLabel = (props: FileLabelProps) => {
...
@@ -26,16 +27,22 @@ export const FileLabel = (props: FileLabelProps) => {
}
}
},
[
isEditable
])
},
[
isEditable
])
useEffect
(()
=>
{
setDefaultValue
(
labelRef
.
current
.
innerText
)
},
[
labelRef
.
current
])
const
handleEditInput
=
(
event
:
React
.
KeyboardEvent
<
HTMLDivElement
>
)
=>
{
const
handleEditInput
=
(
event
:
React
.
KeyboardEvent
<
HTMLDivElement
>
)
=>
{
if
(
event
.
which
===
13
)
{
if
(
event
.
which
===
13
)
{
event
.
preventDefault
()
event
.
preventDefault
()
editModeOff
(
labelRef
.
current
.
innerText
)
editModeOff
(
labelRef
.
current
.
innerText
)
labelRef
.
current
.
innerText
=
defaultValue
}
}
}
}
const
handleEditBlur
=
(
event
:
React
.
SyntheticEvent
)
=>
{
const
handleEditBlur
=
(
event
:
React
.
SyntheticEvent
)
=>
{
event
.
stopPropagation
()
event
.
stopPropagation
()
editModeOff
(
labelRef
.
current
.
innerText
)
editModeOff
(
labelRef
.
current
.
innerText
)
labelRef
.
current
.
innerText
=
defaultValue
}
}
return
(
return
(
...
...
libs/remix-ui/workspace/src/lib/utils/index.ts
View file @
4b6f9282
import
{
MenuItems
}
from
'../types'
export
const
contextMenuActions
:
MenuItems
=
[{
export
const
contextMenuActions
:
MenuItems
=
[{
id
:
'newFile'
,
id
:
'newFile'
,
name
:
'New File'
,
name
:
'New File'
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment