ajout d'image

This commit is contained in:
2026-05-26 18:48:25 +02:00
parent e8db166ee5
commit 663234d5c8
8 changed files with 226 additions and 1 deletions
@@ -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 = '';