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
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
67 additions
and
85 deletions
+67
-85
fileManager.js
apps/remix-ide/src/app/files/fileManager.js
+2
-4
tab-proxy.js
apps/remix-ide/src/app/panels/tab-proxy.js
+59
-77
remix-ui-tabs.css
libs/remix-ui/tabs/src/lib/remix-ui-tabs.css
+6
-4
No files found.
apps/remix-ide/src/app/files/fileManager.js
View file @
efe8b728
...
@@ -121,13 +121,12 @@ class FileManager extends Plugin {
...
@@ -121,13 +121,12 @@ class FileManager extends Plugin {
* @param {string} path path of the directory or file
* @param {string} path path of the directory or file
* @returns {boolean} true if the path exists
* @returns {boolean} true if the path exists
*/
*/
exists
(
path
)
{
async
exists
(
path
)
{
try
{
try
{
path
=
this
.
normalize
(
path
)
path
=
this
.
normalize
(
path
)
path
=
this
.
limitPluginScope
(
path
)
path
=
this
.
limitPluginScope
(
path
)
const
provider
=
this
.
fileProviderOf
(
path
)
const
provider
=
this
.
fileProviderOf
(
path
)
const
result
=
provider
.
exists
(
path
)
const
result
=
await
provider
.
exists
(
path
)
return
result
return
result
}
catch
(
e
)
{
}
catch
(
e
)
{
throw
new
Error
(
e
)
throw
new
Error
(
e
)
...
@@ -301,7 +300,6 @@ class FileManager extends Plugin {
...
@@ -301,7 +300,6 @@ class FileManager extends Plugin {
const
isFile
=
await
this
.
isFile
(
oldPath
)
const
isFile
=
await
this
.
isFile
(
oldPath
)
const
newPathExists
=
await
this
.
exists
(
newPath
)
const
newPathExists
=
await
this
.
exists
(
newPath
)
const
provider
=
this
.
fileProviderOf
(
oldPath
)
const
provider
=
this
.
fileProviderOf
(
oldPath
)
if
(
isFile
)
{
if
(
isFile
)
{
if
(
newPathExists
)
{
if
(
newPathExists
)
{
modalDialogCustom
.
alert
(
'File already exists.'
)
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 {
...
@@ -171,30 +171,6 @@ export class TabProxy extends Plugin {
this
.
tabsApi
.
activateTab
(
''
)
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
()
{
switchToActiveTab
()
{
const
active
=
this
.
tabsApi
.
active
()
const
active
=
this
.
tabsApi
.
active
()
if
(
active
&&
this
.
_handlers
[
active
])
{
if
(
active
&&
this
.
_handlers
[
active
])
{
...
@@ -217,56 +193,62 @@ export class TabProxy extends Plugin {
...
@@ -217,56 +193,62 @@ export class TabProxy extends Plugin {
addTab
(
name
,
title
,
switchTo
,
close
,
icon
)
{
addTab
(
name
,
title
,
switchTo
,
close
,
icon
)
{
if
(
this
.
_handlers
[
name
])
return
this
.
renderComponent
()
if
(
this
.
_handlers
[
name
])
return
this
.
renderComponent
()
var
slash
=
name
.
split
(
'/'
)
// var slash = name.split('/')
const
tabPath
=
slash
.
reverse
()
// const tabPath = slash.reverse()
const
tempTitle
=
[]
// const tempTitle = []
// if (!title) {
if
(
!
title
)
{
// for (let i = 0; i < tabPath.length; i++) {
for
(
let
i
=
0
;
i
<
tabPath
.
length
;
i
++
)
{
// tempTitle.push(tabPath[i])
tempTitle
.
push
(
tabPath
[
i
])
// const formatPath = [...tempTitle].reverse()
const
formatPath
=
[...
tempTitle
].
reverse
()
// const index = this.loadedTabs.findIndex(({ title }) => title === formatPath.join('/'))
const
index
=
this
.
loadedTabs
.
findIndex
(({
title
})
=>
title
===
formatPath
.
join
(
'/'
))
//
// if (index === -1) {
if
(
index
===
-
1
)
{
// title = formatPath.join('/')
title
=
formatPath
.
join
(
'/'
)
// const titleLength = formatPath.length
const
titleLength
=
formatPath
.
length
// this.loadedTabs.push({
this
.
loadedTabs
.
push
({
// id: name,
id
:
name
,
// name,
name
,
// title,
title
,
// icon,
icon
,
// tooltip: name,
tooltip
:
name
,
// iconClass: helper.getPathIcon(name)
iconClass
:
helper
.
getPathIcon
(
name
)
// })
})
// formatPath.shift()
formatPath
.
shift
()
// if (formatPath.length > 0) {
if
(
formatPath
.
length
>
0
)
{
// const duplicateTabName = this.loadedTabs.find(({ title }) => title === formatPath.join('/')).name
const
duplicateTabName
=
this
.
loadedTabs
.
find
(({
title
})
=>
title
===
formatPath
.
join
(
'/'
)).
name
// const duplicateTabPath = duplicateTabName.split('/')
const
duplicateTabPath
=
duplicateTabName
.
split
(
'/'
)
// const duplicateTabFormatPath = [...duplicateTabPath].reverse()
const
duplicateTabFormatPath
=
[...
duplicateTabPath
].
reverse
()
// const duplicateTabTitle = duplicateTabFormatPath.slice(0, titleLength).reverse().join('/')
const
duplicateTabTitle
=
duplicateTabFormatPath
.
slice
(
0
,
titleLength
).
reverse
().
join
(
'/'
)
// this.loadedTabs.push({
// id: duplicateTabName,
this
.
loadedTabs
.
push
({
// name: duplicateTabName,
id
:
duplicateTabName
,
// title: duplicateTabTitle,
name
:
duplicateTabName
,
// icon,
title
:
duplicateTabTitle
,
// tooltip: duplicateTabName,
icon
,
// iconClass: helper.getPathIcon(duplicateTabName)
tooltip
:
duplicateTabName
,
// })
iconClass
:
helper
.
getPathIcon
(
duplicateTabName
)
// }
})
// break
}
// }
break
// }
}
// } else {
}
// this.loadedTabs.push({
}
else
{
// id: name,
this
.
loadedTabs
.
push
({
// name,
id
:
name
,
// title,
name
,
// icon,
title
,
// tooltip: name,
icon
,
// iconClass: helper.getPathIcon(name)
tooltip
:
name
,
// })
iconClass
:
helper
.
getPathIcon
(
name
)
// }
})
this
.
loadedTabs
.
push
({
}
id
:
name
,
name
,
title
:
name
.
split
(
'/'
).
reverse
()[
0
],
icon
,
tooltip
:
name
,
iconClass
:
helper
.
getPathIcon
(
name
)
})
this
.
renderComponent
()
this
.
renderComponent
()
this
.
updateImgStyles
()
this
.
updateImgStyles
()
...
@@ -274,16 +256,16 @@ export class TabProxy extends Plugin {
...
@@ -274,16 +256,16 @@ export class TabProxy extends Plugin {
}
}
removeTab
(
name
)
{
removeTab
(
name
)
{
delete
this
.
_handlers
[
name
]
const
i
=
this
.
loadedTabs
.
findIndex
(
tab
=>
tab
.
name
===
name
)
const
i
=
this
.
loadedTabs
.
findIndex
(
tab
=>
tab
.
name
===
name
)
if
(
name
===
this
.
tabsApi
.
active
())
{
if
(
name
===
this
.
tabsApi
.
active
())
{
if
(
i
>
0
)
{
if
(
i
>
0
)
{
this
.
switch
PreviousTab
(
)
this
.
switch
Tab
(
this
.
loadedTabs
[
i
-
1
].
name
)
}
else
if
(
i
===
0
&&
this
.
loadedTabs
.
length
>
1
)
{
}
else
if
(
i
===
0
&&
this
.
loadedTabs
.
length
>
1
)
{
this
.
switch
NextTab
(
)
this
.
switch
Tab
(
this
.
loadedTabs
[
i
+
1
].
name
)
}
else
{
}
else
{
this
.
clearTab
()
this
.
clearTab
()
}
}
delete
this
.
_handlers
[
name
]
}
else
{
}
else
{
this
.
switchToActiveTab
()
this
.
switchToActiveTab
()
}
}
...
...
libs/remix-ui/tabs/src/lib/remix-ui-tabs.css
View file @
efe8b728
.remix-ui-tabs
{
.remix-ui-tabs
{
display
:
-webkit-box
;
display
:
-webkit-box
;
max-height
:
42px
max-height
:
42px
;
display
:
flex
;
}
}
.remix-ui-tabs
li
{
.remix-ui-tabs
li
{
display
:
inline-block
;
display
:
inline-block
;
...
@@ -44,7 +45,8 @@
...
@@ -44,7 +45,8 @@
overflow-x
:
auto
;
overflow-x
:
auto
;
overflow-y
:
hidden
;
overflow-y
:
hidden
;
white-space
:
nowrap
;
white-space
:
nowrap
;
max-width
:
1000px
;
flex
:
1
;
/*max-width: 1000px;*/
}
}
.left-icon
{
.left-icon
{
width
:
70px
;
width
:
70px
;
...
@@ -55,7 +57,7 @@
...
@@ -55,7 +57,7 @@
.tab-scroll
::-webkit-scrollbar
{
.tab-scroll
::-webkit-scrollbar
{
display
:
none
;
display
:
none
;
}
}
/* Hide scrollbar for IE, Edge and Firefox */
/* Hide scrollbar for IE, Edge and Firefox */
.tab-scroll
{
.tab-scroll
{
-ms-overflow-style
:
none
;
/* IE and Edge */
-ms-overflow-style
:
none
;
/* IE and Edge */
...
...
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