Skip to content

Commit

Permalink
Backmerge: #6411 – Ketcher structure copy-paste in KET instead of MOL (
Browse files Browse the repository at this point in the history
…#6426)

* #6411 – Revert copying functionality changes (#6420)

* - updated screenshot

* - updated test

---------

Co-authored-by: Nikita Chistousov <[email protected]>
  • Loading branch information
rrodionov91 and svvald authored Feb 6, 2025
1 parent caf34d8 commit 260e96c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable no-magic-numbers */
import { test } from '@playwright/test';
import {
openFileAndAddToCanvas,
Expand All @@ -9,6 +10,9 @@ import {
copyToClipboardByKeyboard,
selectTopPanelButton,
pasteFromClipboardByKeyboard,
selectRing,
RingButton,
clickOnCanvas,
} from '@utils';
import { TopPanelButton } from '@utils/selectors';

Expand Down Expand Up @@ -40,6 +44,13 @@ test.describe('Paste Tool', () => {
After fixing the issue, the test should be updated.
*/
await drawBenzeneRing(page);

await selectRing(RingButton.Benzene, page);
await clickOnCanvas(page, 200, 200);

await selectRing(RingButton.Benzene, page);
await clickOnCanvas(page, 400, 400);

await selectAllStructuresOnCanvas(page);
await copyToClipboardByKeyboard(page);
await selectTopPanelButton(TopPanelButton.Open, page);
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 1 addition & 8 deletions packages/ketcher-react/src/script/ui/state/hotkeys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -293,13 +293,6 @@ export function initClipboard(dispatch) {
}, ketcherInstance.eventBus);
return result;
},
onLegacyCopy() {
const state = global.currentState;
const editor = state.editor;
const data = legacyClipData(editor);
editor.selection(null);
return data;
},
async onCopy() {
const ketcherInstance = ketcherProvider.getKetcher();
const result = await runAsyncAction(async () => {
Expand Down Expand Up @@ -398,7 +391,7 @@ async function clipData(editor: Editor) {
? ChemicalMimeType.Mol
: ChemicalMimeType.Rxn;

res['text/plain'] = ket;
res['text/plain'] = data;
res[type] = data;

return res;
Expand Down

0 comments on commit 260e96c

Please sign in to comment.