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
5d390c61
Commit
5d390c61
authored
Mar 18, 2018
by
bitpshr
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Focus new file name input when modal opens
parent
d631ccb4
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
6 deletions
+16
-6
file-panel.js
src/app/panels/file-panel.js
+1
-1
modal-dialog-custom.js
src/app/ui/modal-dialog-custom.js
+5
-4
modaldialog.js
src/app/ui/modaldialog.js
+10
-1
No files found.
src/app/panels/file-panel.js
View file @
5d390c61
...
...
@@ -242,7 +242,7 @@ function filepanel (appAPI, filesProvider) {
appAPI
.
switchFile
(
filesProvider
[
'browser'
].
type
+
'/'
+
newName
)
}
})
})
}
,
null
,
true
)
}
/**
...
...
src/app/ui/modal-dialog-custom.js
View file @
5d390c61
...
...
@@ -6,8 +6,8 @@ module.exports = {
alert
:
function
(
text
)
{
modal
(
''
,
yo
`<div>
${
text
}
</div>`
,
null
,
{
label
:
null
})
},
prompt
:
function
(
title
,
text
,
inputValue
,
ok
,
cancel
)
{
prompt
(
title
,
text
,
false
,
inputValue
,
ok
,
cancel
)
prompt
:
function
(
title
,
text
,
inputValue
,
ok
,
cancel
,
focus
)
{
prompt
(
title
,
text
,
false
,
inputValue
,
ok
,
cancel
,
focus
)
},
promptPassphrase
:
function
(
title
,
text
,
inputValue
,
ok
,
cancel
)
{
prompt
(
title
,
text
,
true
,
inputValue
,
ok
,
cancel
)
...
...
@@ -63,7 +63,7 @@ module.exports = {
}
}
function
prompt
(
title
,
text
,
hidden
,
inputValue
,
ok
,
cancel
)
{
function
prompt
(
title
,
text
,
hidden
,
inputValue
,
ok
,
cancel
,
focus
)
{
if
(
!
inputValue
)
inputValue
=
''
var
type
=
hidden
?
'password'
:
'text'
var
input
=
yo
`<input type=
${
type
}
name='prompt_text' id='prompt_text' class="
${
css
[
'prompt_text'
]}
" value='
${
inputValue
}
' >`
...
...
@@ -73,6 +73,7 @@ function prompt (title, text, hidden, inputValue, ok, cancel) {
},
{
fn
:
()
=>
{
if
(
typeof
cancel
===
'function'
)
cancel
()
}
}
},
focus
?
'#prompt_text'
:
undefined
)
}
src/app/ui/modaldialog.js
View file @
5d390c61
var
yo
=
require
(
'yo-yo'
)
var
css
=
require
(
'./styles/modaldialog-styles'
)
module
.
exports
=
(
title
,
content
,
ok
,
cancel
)
=>
{
module
.
exports
=
(
title
,
content
,
ok
,
cancel
,
focusSelector
)
=>
{
var
container
=
document
.
querySelector
(
`.
${
css
.
modal
}
`
)
if
(
!
container
)
{
document
.
querySelector
(
'body'
).
appendChild
(
html
())
...
...
@@ -54,6 +54,15 @@ module.exports = (title, content, ok, cancel) => {
function
show
()
{
container
.
style
.
display
=
'block'
if
(
focusSelector
)
{
const
focusTarget
=
document
.
querySelector
(
`.
${
css
.
modal
}
${
focusSelector
}
`
)
if
(
focusTarget
)
{
focusTarget
.
focus
()
if
(
typeof
focusTarget
.
setSelectionRange
===
'function'
)
{
focusTarget
.
setSelectionRange
(
0
,
focusTarget
.
value
.
length
)
}
}
}
}
function
removeEventListener
()
{
...
...
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