Skip to content

Commit

Permalink
#4708 – Forbid merging cyclic sequences on delete in Sequence mode
Browse files Browse the repository at this point in the history
  • Loading branch information
svvald committed Jun 6, 2024
1 parent d86e93f commit 24fa531
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions packages/ketcher-core/src/application/editor/modes/SequenceMode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,22 @@ export class SequenceMode extends BaseMode {
direction === Direction.Left
? SequenceRenderer.previousNode
: SequenceRenderer.getNodeByPointer(SequenceRenderer.caretPosition);

if (
!this.areR1R2Free(
SequenceRenderer.nextNode,
SequenceRenderer.previousNode,
)
) {
editor.events.openErrorModal.dispatch({
errorTitle: 'Error Message',
errorMessage:
'It is impossible to merge fragments. Attachment point to establish bonds are not available.',
});

return;
}

const caretPosition =
direction === Direction.Left
? (SequenceRenderer.previousCaretPosition as number)
Expand Down

0 comments on commit 24fa531

Please sign in to comment.