Merge pull request #4025 from Fadiabb/shift-enter-submit
add shift-enter shortcut
This commit is contained in:
commit
0a361665c4
1
AUTHORS
1
AUTHORS
@ -28,3 +28,4 @@ Authors of OpenSlides in chronological order of first contribution:
|
||||
Andreas Engler <engel.a@web.de> (Russian translation)
|
||||
Raimund Renkert <raimund@renkert.org>
|
||||
Jochen Saalfeld <jochen.saalfeld@intevation.de>
|
||||
Fadi Abbud <fmfn13@hotmail.com>
|
||||
|
@ -6,6 +6,6 @@
|
||||
"bracketSpacing": true,
|
||||
"htmlWhitespaceSensitivity": "strict",
|
||||
"semi": true,
|
||||
"trailingComma": "es5",
|
||||
"trailingComma": "none",
|
||||
"arrowParens": "avoid"
|
||||
}
|
||||
|
@ -1,5 +1,10 @@
|
||||
<os-head-bar [nav]="false" [goBack]="true" [editMode]="editTopic"
|
||||
(mainEvent)="setEditMode(!editTopic)" (saveEvent)="saveTopic()">
|
||||
<os-head-bar
|
||||
[nav]="false"
|
||||
[goBack]="true"
|
||||
[editMode]="editTopic"
|
||||
(mainEvent)="setEditMode(!editTopic)"
|
||||
(saveEvent)="saveTopic()"
|
||||
>
|
||||
<!-- Title -->
|
||||
<div class="title-slot">
|
||||
<h2>
|
||||
@ -20,15 +25,13 @@
|
||||
|
||||
<div *ngIf="topic" class="topic-container on-transition-fade">
|
||||
<div class="topic-title">
|
||||
<h2 *ngIf="!editTopic">{{ topic.title }}</h2>
|
||||
<h2 *ngIf="editTopic">{{ topicForm.get('title').value }}</h2>
|
||||
<h2 *ngIf="!editTopic">{{ topic.title }}</h2> <h2 *ngIf="editTopic">{{ topicForm.get('title').value }}</h2>
|
||||
</div>
|
||||
|
||||
<mat-card *ngIf="topic || editTopic" class="topic-text">
|
||||
<div>
|
||||
<span *ngIf="!editTopic">
|
||||
{{ topic.text }}
|
||||
<div *ngIf="topic.text === ''" class="missing" translate>No description provided.</div>
|
||||
{{ topic.text }} <div *ngIf="topic.text === ''" class="missing" translate>No description provided.</div>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -39,11 +42,17 @@
|
||||
</h3>
|
||||
</div>
|
||||
|
||||
<form *ngIf="editTopic" [formGroup]="topicForm" (ngSubmit)="saveTopic()" (keydown)="keyDownFunction($event)">
|
||||
<form *ngIf="editTopic" [formGroup]="topicForm" (keydown)="onKeyDown($event)" (ngSubmit)="saveTopic()">
|
||||
<div>
|
||||
<mat-form-field>
|
||||
<input type="text" matInput osAutofocus required
|
||||
formControlName="title" placeholder="{{ 'Title' | translate}}"/>
|
||||
<input
|
||||
type="text"
|
||||
matInput
|
||||
osAutofocus
|
||||
required
|
||||
formControlName="title"
|
||||
placeholder="{{ 'Title' | translate}}"
|
||||
/>
|
||||
<mat-error *ngIf="topicForm.invalid" translate>A name is required</mat-error>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
@ -174,11 +174,17 @@ export class TopicDetailComponent {
|
||||
}
|
||||
|
||||
/**
|
||||
* clicking Shift and Enter will save automatically
|
||||
* Hitting escape while in topicForm should cancel editing
|
||||
*
|
||||
* @param event has the code
|
||||
*/
|
||||
public keyDownFunction(event: KeyboardEvent): void {
|
||||
if (event.key === "Escape") {
|
||||
public onKeyDown(event: KeyboardEvent): void {
|
||||
if (event.key === 'Enter' && event.shiftKey) {
|
||||
this.saveTopic();
|
||||
}
|
||||
|
||||
if (event.key === 'Escape') {
|
||||
this.setEditMode(false);
|
||||
}
|
||||
}
|
||||
|
@ -137,7 +137,7 @@
|
||||
</ng-template>
|
||||
|
||||
<ng-template #metaInfoTemplate>
|
||||
<form [formGroup]='metaInfoForm' (ngSubmit)='saveMotion()'>
|
||||
<form [formGroup]='metaInfoForm' (keydown)="onKeyDown($event)" (ngSubmit)='saveMotion()'>
|
||||
|
||||
<!-- Identifier -->
|
||||
<div *ngIf="editMotion && !newMotion">
|
||||
@ -256,7 +256,7 @@
|
||||
</ng-template>
|
||||
|
||||
<ng-template #contentTemplate>
|
||||
<form class="motion-content" [formGroup]='contentForm' (ngSubmit)='saveMotion()'>
|
||||
<form class="motion-content" [formGroup]='contentForm' (clickdown)="onKeyDown($event)" (keydown)="onKeyDown($event)" (ngSubmit)='saveMotion()'>
|
||||
|
||||
<!-- Line Number and Diff buttons-->
|
||||
<div *ngIf="motion && !editMotion && !motion.isStatuteAmendment()" class="motion-text-controls">
|
||||
|
@ -291,6 +291,17 @@ export class MotionDetailComponent extends BaseViewComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* clicking Shift and Enter will save automatically
|
||||
*
|
||||
* @param event has the code
|
||||
*/
|
||||
public onKeyDown(event: KeyboardEvent): void {
|
||||
if (event.key === 'Enter' && event.shiftKey) {
|
||||
this.saveMotion();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Save a motion. Calls the "patchValues" function in the MotionObject
|
||||
*
|
||||
|
@ -29,7 +29,7 @@
|
||||
</os-head-bar>
|
||||
|
||||
<mat-card class="os-card" *osPerms="'users.can_see_name'">
|
||||
<form [ngClass]="{'mat-form-field-enabled': editUser}" [formGroup]="personalInfoForm" (ngSubmit)="saveUser()" *ngIf="user">
|
||||
<form [ngClass]="{'mat-form-field-enabled': editUser}" [formGroup]="personalInfoForm" (ngSubmit)="saveUser()" *ngIf="user" (keydown)="onKeyDown($event)">
|
||||
<!-- <h3 translate>Personal Data</h3> -->
|
||||
<div *ngIf="isAllowed('seeName')">
|
||||
<!-- Title -->
|
||||
|
@ -274,6 +274,17 @@ export class UserDetailComponent extends BaseViewComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* clicking Shift and Enter will save automatically
|
||||
*
|
||||
* @param event has the code
|
||||
*/
|
||||
public onKeyDown(event: KeyboardEvent): void {
|
||||
if (event.key === 'Enter' && event.shiftKey) {
|
||||
this.saveUser();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Save / Submit a user
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user