diff --git a/src/app/component/chat-input/chat-input.component.html b/src/app/component/chat-input/chat-input.component.html index 9be95d3c..e629d7cf 100644 --- a/src/app/component/chat-input/chat-input.component.html +++ b/src/app/component/chat-input/chat-input.component.html @@ -69,7 +69,7 @@ diff --git a/src/app/component/chat-input/chat-input.component.ts b/src/app/component/chat-input/chat-input.component.ts index 7a38aa2c..fe1c04f1 100644 --- a/src/app/component/chat-input/chat-input.component.ts +++ b/src/app/component/chat-input/chat-input.component.ts @@ -39,7 +39,7 @@ interface StandGroup { styleUrls: ['./chat-input.component.css'] }) export class ChatInputComponent implements OnInit, OnDestroy { - @ViewChild('textArea', { static: true }) textAreaElementRef: ElementRef; + @ViewChild('textArea', { static: true }) textAreaElementRef: ElementRef; @Input() onlyCharacters: boolean = false; @Input() chatTabidentifier: string = ''; @@ -78,6 +78,8 @@ export class ChatInputComponent implements OnInit, OnDestroy { get filterText(): string { return this._filterText }; set filterText(filterText: string) { this._filterText = filterText; this.filterTextChange.emit(filterText); } + @Output() moveToPalette = new EventEmitter(); + @Output() chat = new EventEmitter<{ text: string, gameType: string, sendFrom: string, sendTo: string, color?: string, @@ -352,6 +354,15 @@ export class ChatInputComponent implements OnInit, OnDestroy { this.calcFitHeight(); } + moveTo(e: Event) { + if (!this.textAreaElementRef) return; + if (this.textAreaElementRef.nativeElement.selectionStart != this.textAreaElementRef.nativeElement.selectionEnd) return; + if (this.textAreaElementRef.nativeElement.selectionStart === this.textAreaElementRef.nativeElement.value.length) { + this.moveToPalette.emit(); + e.preventDefault(); + } + } + sendChat(event: Partial) { if (event) event.preventDefault(); //if (!this.text.length) return; diff --git a/src/app/component/chat-palette/chat-palette.component.html b/src/app/component/chat-palette/chat-palette.component.html index 49c048a2..cf8bf0be 100644 --- a/src/app/component/chat-palette/chat-palette.component.html +++ b/src/app/component/chat-palette/chat-palette.component.html @@ -8,7 +8,7 @@ -
info_outline チャットパレット編集中
@@ -16,7 +16,7 @@
- diff --git a/src/app/component/chat-palette/chat-palette.component.ts b/src/app/component/chat-palette/chat-palette.component.ts index f4a96e84..3581134f 100644 --- a/src/app/component/chat-palette/chat-palette.component.ts +++ b/src/app/component/chat-palette/chat-palette.component.ts @@ -117,6 +117,38 @@ export class ChatPaletteComponent implements OnInit, OnDestroy { } } + moveToInput(e: Event) { + if (!this.chatPletteElementRef.nativeElement) return; + const selectedPaletteIndex = this.chatPletteElementRef.nativeElement.selectedIndex; + if (selectedPaletteIndex <= 0) { + this.chatInputComponent.textAreaElementRef.nativeElement.focus(); + e.preventDefault(); + } + } + + arrowPalette() { + if (!this.chatPletteElementRef.nativeElement) return; + this.selectedPaletteIndex = this.chatPletteElementRef.nativeElement.selectedIndex; + if (this.selectedPaletteIndex >= 0 && this.chatPletteElementRef.nativeElement.options[this.selectedPaletteIndex]) { + this.text = this.palette.evaluate(this.chatPletteElementRef.nativeElement.options[this.selectedPaletteIndex].value, this.character.rootDataElement); + let textArea: HTMLTextAreaElement = this.chatInputComponent.textAreaElementRef.nativeElement; + textArea.value = this.text; + } + } + + enterPalette(line: string) { + if (!this.chatPletteElementRef.nativeElement) return; + this.text = this.palette.evaluate(line, this.character.rootDataElement); + this.chatInputComponent.sendChat(null); + } + + moveToPalette() { + if (!this.chatPletteElementRef.nativeElement) return; + if (this.chatPletteElementRef.nativeElement.options.length <= 0) return; + this.chatPletteElementRef.nativeElement.options[0].selected = true; + this.chatPletteElementRef.nativeElement.focus(); + } + sendChat(value: { text: string, gameType: string, sendFrom: string, sendTo: string, color?: string, isInverse?:boolean, isHollow?: boolean, isBlackPaint?: boolean, aura?: number, isUseFaceIcon?: boolean, characterIdentifier?: string, standIdentifier?: string, standName?: string, isUseStandImage?: boolean }) { if (this.chatTab) {