diff --git a/.gitignore b/.gitignore index 3631589b0..99959503e 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ *.log .vscode +.awcache # Build results bin/ diff --git a/src/Squidex/app/features/schemas/pages/schema/field-wizard.component.ts b/src/Squidex/app/features/schemas/pages/schema/field-wizard.component.ts index 0021baa7f..304f072db 100644 --- a/src/Squidex/app/features/schemas/pages/schema/field-wizard.component.ts +++ b/src/Squidex/app/features/schemas/pages/schema/field-wizard.component.ts @@ -24,7 +24,7 @@ import { }) export class FieldWizardComponent implements OnInit { @ViewChild('nameInput') - public nameInput: ElementRef; + public nameInput: ElementRef; @Input() public schema: SchemaDetailsDto; diff --git a/src/Squidex/app/framework/angular/forms/iframe-editor.component.ts b/src/Squidex/app/framework/angular/forms/iframe-editor.component.ts index 374da7303..27f237315 100644 --- a/src/Squidex/app/framework/angular/forms/iframe-editor.component.ts +++ b/src/Squidex/app/framework/angular/forms/iframe-editor.component.ts @@ -32,7 +32,7 @@ export class IFrameEditorComponent implements ControlValueAccessor, AfterViewIni private plugin: HTMLIFrameElement; @ViewChild('iframe') - public iframe: ElementRef; + public iframe: ElementRef; @Input() public set url(value: string) { diff --git a/src/Squidex/app/framework/angular/forms/slider.component.ts b/src/Squidex/app/framework/angular/forms/slider.component.ts index 5f6a78a8f..a95fc4f3b 100644 --- a/src/Squidex/app/framework/angular/forms/slider.component.ts +++ b/src/Squidex/app/framework/angular/forms/slider.component.ts @@ -32,10 +32,10 @@ export class SliderComponent implements ControlValueAccessor { private isDragging = false; @ViewChild('bar') - public bar: ElementRef; + public bar: ElementRef; @ViewChild('thumb') - public thumb: ElementRef; + public thumb: ElementRef; @Input() public min = 0; diff --git a/src/Squidex/app/framework/angular/forms/tag-editor.component.html b/src/Squidex/app/framework/angular/forms/tag-editor.component.html index 0c3dbe926..5aa03539b 100644 --- a/src/Squidex/app/framework/angular/forms/tag-editor.component.html +++ b/src/Squidex/app/framework/angular/forms/tag-editor.component.html @@ -9,6 +9,9 @@ ; @ViewChild('input') - public inputElement: ElementRef; + public inputElement: ElementRef; public hasFocus = false; @@ -340,6 +340,51 @@ export class TagEditorComponent implements AfterViewInit, ControlValueAccessor, this.selectIndex(this.suggestedIndex + 1); } + public onCut(event: ClipboardEvent) { + if (!this.hasSelection()) { + this.onCopy(event); + + this.updateItems([]); + } + } + + public onCopy(event: ClipboardEvent) { + if (!this.hasSelection()) { + event.clipboardData.setData('text/plain', this.items.filter(x => !!x).join(',')); + + event.preventDefault(); + } + } + + public onPaste(event: ClipboardEvent) { + const value = event.clipboardData.getData('text/plain'); + + if (value) { + this.resetForm(); + + const values = [...this.items]; + + for (let part of value.split(',')) { + const converted = this.converter.convert(part); + + if (converted) { + values.push(converted); + } + } + + this.updateItems(values); + } + + event.preventDefault(); + } + + private hasSelection() { + const s = this.inputElement.nativeElement.selectionStart; + const e = this.inputElement.nativeElement.selectionEnd; + + return s && e && (e - s) > 0; + } + private updateItems(items: any[]) { this.items = items; diff --git a/src/Squidex/app/framework/angular/modals/modal-dialog.component.ts b/src/Squidex/app/framework/angular/modals/modal-dialog.component.ts index e33ec56ad..20c685ff0 100644 --- a/src/Squidex/app/framework/angular/modals/modal-dialog.component.ts +++ b/src/Squidex/app/framework/angular/modals/modal-dialog.component.ts @@ -47,10 +47,10 @@ export class ModalDialogComponent implements AfterViewInit { public closed = new EventEmitter(); @ViewChild('tabsElement') - public tabsElement: ElementRef; + public tabsElement: ElementRef; @ViewChild('footerElement') - public footerElement: ElementRef; + public footerElement: ElementRef; public hasTabs = false; public hasFooter = false; diff --git a/src/Squidex/app/framework/angular/panel.component.ts b/src/Squidex/app/framework/angular/panel.component.ts index e73ce66a3..4556ed9b7 100644 --- a/src/Squidex/app/framework/angular/panel.component.ts +++ b/src/Squidex/app/framework/angular/panel.component.ts @@ -59,7 +59,7 @@ export class PanelComponent implements AfterViewInit, OnDestroy, OnInit { public sidebarClass = ''; @ViewChild('panel') - public panel: ElementRef; + public panel: ElementRef; constructor( private readonly container: PanelContainerDirective,