ajout d'image
This commit is contained in:
@@ -2,6 +2,7 @@ import { Component, computed, inject, input } from '@angular/core';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { DomSanitizer, SafeHtml } from '@angular/platform-browser';
|
||||
import { marked } from 'marked';
|
||||
import { handleImagePaste, insertAtSelection } from '../paste-image.util';
|
||||
import { IssueComment, IssuesStore } from '../issues.store';
|
||||
|
||||
@Component({
|
||||
@@ -68,6 +69,19 @@ export class IssueComments {
|
||||
this.editingCommentText = '';
|
||||
}
|
||||
|
||||
protected onPaste(event: ClipboardEvent, field: 'new' | 'edit'): void {
|
||||
const ta = event.target as HTMLTextAreaElement;
|
||||
const start = ta.selectionStart;
|
||||
const end = ta.selectionEnd;
|
||||
handleImagePaste(event, (md) => {
|
||||
if (field === 'new') {
|
||||
this.newCommentText = insertAtSelection(ta, this.newCommentText, start, end, md);
|
||||
} else {
|
||||
this.editingCommentText = insertAtSelection(ta, this.editingCommentText, start, end, md);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected cancelEditComment(): void {
|
||||
this.editingCommentId = null;
|
||||
this.editingCommentText = '';
|
||||
|
||||
Reference in New Issue
Block a user