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
4a63ffdd
Commit
4a63ffdd
authored
Feb 09, 2018
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improve file name editing
parent
4f7ffa3b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
4 deletions
+10
-4
file-explorer.js
src/app/files/file-explorer.js
+10
-4
No files found.
src/app/files/file-explorer.js
View file @
4a63ffdd
...
...
@@ -220,13 +220,21 @@ function fileExplorer (appAPI, files) {
})
var
textUnderEdit
=
null
var
textInRename
=
false
function
selectElementContents
(
el
)
{
var
range
=
document
.
createRange
()
range
.
selectNodeContents
(
el
)
var
sel
=
window
.
getSelection
()
sel
.
removeAllRanges
()
sel
.
addRange
(
range
)
}
function
editModeOn
(
label
)
{
textUnderEdit
=
label
.
innerText
label
.
setAttribute
(
'contenteditable'
,
true
)
label
.
classList
.
add
(
css
.
rename
)
label
.
focus
()
selectElementContents
(
label
)
}
function
editModeOff
(
event
)
{
...
...
@@ -251,8 +259,7 @@ function fileExplorer (appAPI, files) {
}
if
(
event
.
which
===
13
)
event
.
preventDefault
()
if
(
!
textInRename
&&
(
event
.
type
===
'blur'
||
event
.
which
===
27
||
event
.
which
===
13
)
&&
label
.
getAttribute
(
'contenteditable'
))
{
textInRename
=
true
if
(
event
.
type
===
'blur'
||
event
.
which
===
13
&&
label
.
getAttribute
(
'contenteditable'
))
{
var
isFolder
=
label
.
className
.
indexOf
(
'folder'
)
!==
-
1
var
save
=
textUnderEdit
!==
label
.
innerText
if
(
save
)
{
...
...
@@ -260,7 +267,6 @@ function fileExplorer (appAPI, files) {
}
label
.
removeAttribute
(
'contenteditable'
)
label
.
classList
.
remove
(
css
.
rename
)
textInRename
=
false
}
}
}
...
...
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