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
ad47b45d
Commit
ad47b45d
authored
Mar 03, 2021
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
renaming, tes special character
parent
d3b93057
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
4 deletions
+12
-4
remix-ui-workspace.tsx
libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx
+12
-4
No files found.
libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx
View file @
ad47b45d
...
@@ -22,6 +22,10 @@ export interface WorkspaceProps {
...
@@ -22,6 +22,10 @@ export interface WorkspaceProps {
initialWorkspace
:
string
initialWorkspace
:
string
}
}
const
hasSpecialChar
=
(
value
)
=>
{
return
value
.
match
(
/
[
:*?"<>
\\
'|
]
/
)
!=
null
||
value
.
match
(
/
\/
/
)
!=
null
}
var
canUpload
=
window
.
File
||
window
.
FileReader
||
window
.
FileList
||
window
.
Blob
var
canUpload
=
window
.
File
||
window
.
FileReader
||
window
.
FileList
||
window
.
Blob
export
const
Workspace
=
(
props
:
WorkspaceProps
)
=>
{
export
const
Workspace
=
(
props
:
WorkspaceProps
)
=>
{
const
LOCALHOST
=
' - connect to localhost - '
const
LOCALHOST
=
' - connect to localhost - '
...
@@ -152,10 +156,12 @@ export const Workspace = (props: WorkspaceProps) => {
...
@@ -152,10 +156,12 @@ export const Workspace = (props: WorkspaceProps) => {
}
}
const
modalMessage
=
(
title
:
string
,
body
:
string
)
=>
{
const
modalMessage
=
(
title
:
string
,
body
:
string
)
=>
{
modal
(
title
,
body
,
{
setTimeout
(()
=>
{
// wait for any previous modal a chance to close
label
:
'OK'
,
modal
(
title
,
body
,
{
fn
:
()
=>
{}
label
:
'OK'
,
},
null
)
fn
:
()
=>
{}
},
null
)
},
200
)
}
}
const
workspaceRenameInput
=
useRef
()
const
workspaceRenameInput
=
useRef
()
...
@@ -165,6 +171,8 @@ export const Workspace = (props: WorkspaceProps) => {
...
@@ -165,6 +171,8 @@ export const Workspace = (props: WorkspaceProps) => {
if
(
workspaceRenameInput
.
current
===
undefined
)
return
if
(
workspaceRenameInput
.
current
===
undefined
)
return
// @ts-ignore: Object is possibly 'null'.
// @ts-ignore: Object is possibly 'null'.
const
workspaceName
=
workspaceRenameInput
.
current
.
value
const
workspaceName
=
workspaceRenameInput
.
current
.
value
if
(
hasSpecialChar
(
workspaceName
))
return
modalMessage
(
'Workspace Rename'
,
'special characters are not allowed'
)
const
workspacesPath
=
props
.
workspace
.
workspacesPath
const
workspacesPath
=
props
.
workspace
.
workspacesPath
await
props
.
fileManager
.
rename
(
'browser/'
+
workspacesPath
+
'/'
+
state
.
currentWorkspace
,
'browser/'
+
workspacesPath
+
'/'
+
workspaceName
)
await
props
.
fileManager
.
rename
(
'browser/'
+
workspacesPath
+
'/'
+
state
.
currentWorkspace
,
'browser/'
+
workspacesPath
+
'/'
+
workspaceName
)
setWorkspace
(
workspaceName
)
setWorkspace
(
workspaceName
)
...
...
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