changed enter to shift+enter for textarea newline

This commit is contained in:
David Baldwynn 2016-05-13 17:35:52 -07:00
parent 09b14ffc6d
commit 86580351d7
5 changed files with 27 additions and 25 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -6,7 +6,7 @@ angular.module('forms').directive('onEnterKey', ['$rootScope', function($rootSco
link: function($scope, $element, $attrs) { link: function($scope, $element, $attrs) {
$element.bind('keydown keypress', function(event) { $element.bind('keydown keypress', function(event) {
var keyCode = event.which || event.keyCode; var keyCode = event.which || event.keyCode;
if(keyCode === 13) { if(keyCode === 13 && !event.shiftKey) {
event.preventDefault(); event.preventDefault();
$rootScope.$apply(function() { $rootScope.$apply(function() {
$rootScope.$eval($attrs.onEnterKey); $rootScope.$eval($attrs.onEnterKey);

View file

@ -8,22 +8,24 @@
{{field.title}} {{field.title}}
<span class="required-error" ng-show="!field.required">optional</span> <span class="required-error" ng-show="!field.required">optional</span>
</h3> </h3>
<small>press SHIFT+ENTER to create a newline</small>
</div>
<div class="col-xs-12 field-input">
<textarea class="textarea focusOn" type="text"
ng-model="field.fieldValue"
ng-model-options="{ debounce: 250 }"
ng-class="{ 'no-border': !!field.fieldValue }"
value="{{field.fieldValue}}"
ng-required="field.required"
ng-disabled="field.disabled"
ng-focus="setActiveField(field._id, index, true)"
on-enter-key="nextField()">
</textarea>
</div> </div>
<div class="col-xs-12 field-input">
<textarea class="textarea focusOn" type="text"
ng-model="field.fieldValue"
ng-model-options="{ debounce: 250 }"
ng-class="{ 'no-border': !!field.fieldValue }"
value="{{field.fieldValue}}"
ng-required="field.required"
ng-disabled="field.disabled"
ng-focus="setActiveField(field._id, index, true)"
on-enter-key="nextField()">
</textarea>
</div>
</div> </div>
<div> <div>
<div class="btn btn-lg btn-default col-xs-12" <div class="btn btn-lg btn-default col-xs-12 col-sm-4"
style="padding: 4px; margin-top:8px; background: rgba(255,255,255,0.5)"> style="padding: 4px; margin-top:8px; background: rgba(255,255,255,0.5)">
<button ng-disabled="!field.fieldValue || forms.myForm.{{field.fieldType}}{{$index}}.$invalid" <button ng-disabled="!field.fieldValue || forms.myForm.{{field.fieldType}}{{$index}}.$invalid"
ng-style="{'background-color':design.colors.buttonColor, 'color':design.colors.buttonTextColor}" ng-style="{'background-color':design.colors.buttonColor, 'color':design.colors.buttonTextColor}"

View file

@ -41,7 +41,7 @@
</div> </div>
</div> </div>
<div> <div>
<div class="btn btn-lg btn-default col-xs-12" <div class="btn btn-lg btn-default col-xs-12 col-sm-4"
style="padding: 4px; margin-top:8px; background: rgba(255,255,255,0.5)"> style="padding: 4px; margin-top:8px; background: rgba(255,255,255,0.5)">
<button ng-disabled="!field.fieldValue || forms.myForm.{{field.fieldType}}{{$index}}.$invalid" <button ng-disabled="!field.fieldValue || forms.myForm.{{field.fieldType}}{{$index}}.$invalid"
ng-style="{'background-color':design.colors.buttonColor, 'color':design.colors.buttonTextColor}" ng-style="{'background-color':design.colors.buttonColor, 'color':design.colors.buttonTextColor}"
@ -50,7 +50,7 @@
OK <i class="fa fa-check"></i> OK <i class="fa fa-check"></i>
</button> </button>
<div class="col-sm-3 col-xs-6" style="margin-top:0.2em"> <div class="col-xs-6 col-sm-3" style="margin-top:0.2em">
<small style="color:#ddd; font-size:70%"> <small style="color:#ddd; font-size:70%">
press ENTER press ENTER
</small> </small>