(messageTs: number, editedContent: string, images?: string[])
| 369 | * Handles message editing operations with user confirmation |
| 370 | */ |
| 371 | const handleEditOperation = async (messageTs: number, editedContent: string, images?: string[]): Promise<void> => { |
| 372 | // Check if there's a checkpoint before this message |
| 373 | const currentCline = provider.getCurrentTask() |
| 374 | let hasCheckpoint = false |
| 375 | if (currentCline) { |
| 376 | const { messageIndex } = findMessageIndices(messageTs, currentCline) |
| 377 | if (messageIndex !== -1) { |
| 378 | // Find the last checkpoint before this message |
| 379 | const checkpoints = currentCline.clineMessages.filter( |
| 380 | (msg) => msg.say === "checkpoint_saved" && msg.ts > messageTs, |
| 381 | ) |
| 382 | |
| 383 | hasCheckpoint = checkpoints.length > 0 |
| 384 | } else { |
| 385 | console.log("[webviewMessageHandler] Edit - Message not found in clineMessages!") |
| 386 | } |
| 387 | } else { |
| 388 | console.log("[webviewMessageHandler] Edit - No currentCline available!") |
| 389 | } |
| 390 | |
| 391 | // Send message to webview to show edit confirmation dialog |
| 392 | await provider.postMessageToWebview({ |
| 393 | type: "showEditMessageDialog", |
| 394 | messageTs, |
| 395 | text: editedContent, |
| 396 | hasCheckpoint, |
| 397 | images, |
| 398 | }) |
| 399 | } |
| 400 | |
| 401 | /** |
| 402 | * Handles confirmed message editing from webview dialog |
no test coverage detected