Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ACS
Public
VILLASframework
VILLASweb
Commits
d9deff7b
Commit
d9deff7b
authored
Aug 31, 2018
by
Manuel Pitz
Committed by
Steffen Vogel
Aug 31, 2018
Browse files
activate enter handling and add function to prevent key handling when needed
parent
56da3780
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/components/dialogs/dialog.js
View file @
d9deff7b
...
...
@@ -31,13 +31,21 @@ class Dialog extends React.Component {
this
.
props
.
onClose
(
true
);
}
/**
* To prevent Enter hanlding user onKeyPress={this.handleKeyIgnore} in that form element
* and the following handler in the corresponding file:
*
* //this function prevents a keystroke from beeing handled by dialog.js
* handleKeyIgnore(event){
* event.stopPropagation();
* }
*/
onKeyPress
=
(
event
)
=>
{
/*
if (event.key === 'Enter') {
if
(
event
.
key
===
'
Enter
'
)
{
// prevent input from submitting
event
.
preventDefault
();
this
.
closeModal
(
false
);
}
*/
}
}
render
()
{
...
...
src/components/dialogs/edit-widget-html-content.js
View file @
d9deff7b
...
...
@@ -31,15 +31,20 @@ class EditWidgetHTMLContent extends React.Component {
};
}
handleKeyIgnore
(
event
){
// This function prevents a keystroke from beeing handled by dialog.js
event
.
stopPropagation
();
}
componentWillReceiveProps
(
nextProps
)
{
// Update state's widget with props
// Update state's widget with props
this
.
setState
({
widget
:
nextProps
.
widget
});
}
render
()
{
return
<
FormGroup
controlId
=
{
this
.
props
.
controlId
}
>
<
ControlLabel
>
HTML
Content
<
/ControlLabel
>
<
FormControl
componentClass
=
"
textarea
"
style
=
{{
height
:
200
}}
placeholder
=
{
this
.
props
.
placeholder
}
value
=
{
this
.
state
.
widget
[
this
.
props
.
controlId
]
||
''
}
onChange
=
{
e
=>
this
.
props
.
handleChange
(
e
)}
/
>
<
FormControl
onKeyPress
=
{
this
.
handleKeyIgnore
}
componentClass
=
"
textarea
"
style
=
{{
height
:
200
}}
placeholder
=
{
this
.
props
.
placeholder
}
value
=
{
this
.
state
.
widget
[
this
.
props
.
controlId
]
||
''
}
onChange
=
{
e
=>
this
.
props
.
handleChange
(
e
)}
/
>
<
/FormGroup>
;
}
}
...
...
Write
Preview
Supports
Markdown
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