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
f1a935ba
Unverified
Commit
f1a935ba
authored
Mar 26, 2018
by
yann300
Committed by
GitHub
Mar 26, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1160 from bitpshr/feature/focus-filename-input
Focus new file name input
parents
d631ccb4
5d390c61
Hide 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 @
f1a935ba
...
...
@@ -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 @
f1a935ba
...
...
@@ -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 @
f1a935ba
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