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
efe8b728
Commit
efe8b728
authored
Nov 29, 2021
by
gxkai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 目录树与页签联动
parent
28600f7d
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
58 additions
and
76 deletions
+58
-76
fileManager.js
apps/remix-ide/src/app/files/fileManager.js
+2
-4
tab-proxy.js
apps/remix-ide/src/app/panels/tab-proxy.js
+52
-70
remix-ui-tabs.css
libs/remix-ui/tabs/src/lib/remix-ui-tabs.css
+4
-2
No files found.
apps/remix-ide/src/app/files/fileManager.js
View file @
efe8b728
...
...
@@ -121,13 +121,12 @@ class FileManager extends Plugin {
* @param {string} path path of the directory or file
* @returns {boolean} true if the path exists
*/
exists
(
path
)
{
async
exists
(
path
)
{
try
{
path
=
this
.
normalize
(
path
)
path
=
this
.
limitPluginScope
(
path
)
const
provider
=
this
.
fileProviderOf
(
path
)
const
result
=
provider
.
exists
(
path
)
const
result
=
await
provider
.
exists
(
path
)
return
result
}
catch
(
e
)
{
throw
new
Error
(
e
)
...
...
@@ -301,7 +300,6 @@ class FileManager extends Plugin {
const
isFile
=
await
this
.
isFile
(
oldPath
)
const
newPathExists
=
await
this
.
exists
(
newPath
)
const
provider
=
this
.
fileProviderOf
(
oldPath
)
if
(
isFile
)
{
if
(
newPathExists
)
{
modalDialogCustom
.
alert
(
'File already exists.'
)
...
...
apps/remix-ide/src/app/panels/tab-proxy.js
View file @
efe8b728
...
...
@@ -171,30 +171,6 @@ export class TabProxy extends Plugin {
this
.
tabsApi
.
activateTab
(
''
)
}
switchNextTab
()
{
const
active
=
this
.
tabsApi
.
active
()
if
(
active
&&
this
.
_handlers
[
active
])
{
const
handlers
=
Object
.
keys
(
this
.
_handlers
)
let
i
=
handlers
.
indexOf
(
active
)
if
(
i
>=
0
)
{
i
=
handlers
[
i
+
1
]
?
i
+
1
:
0
this
.
switchTab
(
handlers
[
i
])
}
}
}
switchPreviousTab
()
{
const
active
=
this
.
tabsApi
.
active
()
if
(
active
&&
this
.
_handlers
[
active
])
{
const
handlers
=
Object
.
keys
(
this
.
_handlers
)
let
i
=
handlers
.
indexOf
(
active
)
if
(
i
>=
0
)
{
i
=
handlers
[
i
-
1
]
?
i
-
1
:
handlers
.
length
-
1
this
.
switchTab
(
handlers
[
i
])
}
}
}
switchToActiveTab
()
{
const
active
=
this
.
tabsApi
.
active
()
if
(
active
&&
this
.
_handlers
[
active
])
{
...
...
@@ -217,56 +193,62 @@ export class TabProxy extends Plugin {
addTab
(
name
,
title
,
switchTo
,
close
,
icon
)
{
if
(
this
.
_handlers
[
name
])
return
this
.
renderComponent
()
var
slash
=
name
.
split
(
'/'
)
const
tabPath
=
slash
.
reverse
()
const
tempTitle
=
[]
if
(
!
title
)
{
for
(
let
i
=
0
;
i
<
tabPath
.
length
;
i
++
)
{
tempTitle
.
push
(
tabPath
[
i
])
const
formatPath
=
[...
tempTitle
].
reverse
()
const
index
=
this
.
loadedTabs
.
findIndex
(({
title
})
=>
title
===
formatPath
.
join
(
'/'
))
if
(
index
===
-
1
)
{
title
=
formatPath
.
join
(
'/'
)
const
titleLength
=
formatPath
.
length
this
.
loadedTabs
.
push
({
id
:
name
,
name
,
title
,
icon
,
tooltip
:
name
,
iconClass
:
helper
.
getPathIcon
(
name
)
})
formatPath
.
shift
()
if
(
formatPath
.
length
>
0
)
{
const
duplicateTabName
=
this
.
loadedTabs
.
find
(({
title
})
=>
title
===
formatPath
.
join
(
'/'
)).
name
const
duplicateTabPath
=
duplicateTabName
.
split
(
'/'
)
const
duplicateTabFormatPath
=
[...
duplicateTabPath
].
reverse
()
const
duplicateTabTitle
=
duplicateTabFormatPath
.
slice
(
0
,
titleLength
).
reverse
().
join
(
'/'
)
this
.
loadedTabs
.
push
({
id
:
duplicateTabName
,
name
:
duplicateTabName
,
title
:
duplicateTabTitle
,
icon
,
tooltip
:
duplicateTabName
,
iconClass
:
helper
.
getPathIcon
(
duplicateTabName
)
})
}
break
}
}
}
else
{
// var slash = name.split('/')
// const tabPath = slash.reverse()
// const tempTitle = []
// if (!title) {
// for (let i = 0; i < tabPath.length; i++) {
// tempTitle.push(tabPath[i])
// const formatPath = [...tempTitle].reverse()
// const index = this.loadedTabs.findIndex(({ title }) => title === formatPath.join('/'))
//
// if (index === -1) {
// title = formatPath.join('/')
// const titleLength = formatPath.length
// this.loadedTabs.push({
// id: name,
// name,
// title,
// icon,
// tooltip: name,
// iconClass: helper.getPathIcon(name)
// })
// formatPath.shift()
// if (formatPath.length > 0) {
// const duplicateTabName = this.loadedTabs.find(({ title }) => title === formatPath.join('/')).name
// const duplicateTabPath = duplicateTabName.split('/')
// const duplicateTabFormatPath = [...duplicateTabPath].reverse()
// const duplicateTabTitle = duplicateTabFormatPath.slice(0, titleLength).reverse().join('/')
// this.loadedTabs.push({
// id: duplicateTabName,
// name: duplicateTabName,
// title: duplicateTabTitle,
// icon,
// tooltip: duplicateTabName,
// iconClass: helper.getPathIcon(duplicateTabName)
// })
// }
// break
// }
// }
// } else {
// this.loadedTabs.push({
// id: name,
// name,
// title,
// icon,
// tooltip: name,
// iconClass: helper.getPathIcon(name)
// })
// }
this
.
loadedTabs
.
push
({
id
:
name
,
name
,
title
,
title
:
name
.
split
(
'/'
).
reverse
()[
0
]
,
icon
,
tooltip
:
name
,
iconClass
:
helper
.
getPathIcon
(
name
)
})
}
this
.
renderComponent
()
this
.
updateImgStyles
()
...
...
@@ -274,16 +256,16 @@ export class TabProxy extends Plugin {
}
removeTab
(
name
)
{
delete
this
.
_handlers
[
name
]
const
i
=
this
.
loadedTabs
.
findIndex
(
tab
=>
tab
.
name
===
name
)
if
(
name
===
this
.
tabsApi
.
active
())
{
if
(
i
>
0
)
{
this
.
switch
PreviousTab
(
)
this
.
switch
Tab
(
this
.
loadedTabs
[
i
-
1
].
name
)
}
else
if
(
i
===
0
&&
this
.
loadedTabs
.
length
>
1
)
{
this
.
switch
NextTab
(
)
this
.
switch
Tab
(
this
.
loadedTabs
[
i
+
1
].
name
)
}
else
{
this
.
clearTab
()
}
delete
this
.
_handlers
[
name
]
}
else
{
this
.
switchToActiveTab
()
}
...
...
libs/remix-ui/tabs/src/lib/remix-ui-tabs.css
View file @
efe8b728
.remix-ui-tabs
{
display
:
-webkit-box
;
max-height
:
42px
max-height
:
42px
;
display
:
flex
;
}
.remix-ui-tabs
li
{
display
:
inline-block
;
...
...
@@ -44,7 +45,8 @@
overflow-x
:
auto
;
overflow-y
:
hidden
;
white-space
:
nowrap
;
max-width
:
1000px
;
flex
:
1
;
/*max-width: 1000px;*/
}
.left-icon
{
width
:
70px
;
...
...
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