Skip to content

Commit

Permalink
#4238 - getKet function return ket file without selection flags
Browse files Browse the repository at this point in the history
  • Loading branch information
tmrr13 committed Mar 19, 2024
1 parent 0176cab commit dc62239
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
11 changes: 2 additions & 9 deletions packages/ketcher-core/src/application/ketcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import {
parseAndAddMacromoleculesOnCanvas,
prepareStructToRender,
} from './utils';
import { EditorSelection } from './editor/editor.types';

const allowedApiSettings = {
'general.dearomatize-on-load': 'dearomatize-on-load',
Expand Down Expand Up @@ -189,15 +190,7 @@ export class Ketcher {
this.#formatterFactory,
this.#editor.struct(),
CoreEditor.provideEditorInstance()?.drawingEntitiesManager,
);
}

getFasta(): Promise<string> {
return getStructure(
SupportedFormat.fasta,
this.#formatterFactory,
this.#editor.struct(),
CoreEditor.provideEditorInstance()?.drawingEntitiesManager,
this.#editor.selection() as EditorSelection,
);
}

Expand Down
8 changes: 7 additions & 1 deletion packages/ketcher-core/src/application/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { ChemicalMimeType, StructService } from 'domain/services';
import { Coordinates, CoreEditor, EditorHistory } from './editor/internal';
import { KetSerializer } from 'domain/serializers';
import assert from 'assert';
import { EditorSelection } from './editor/editor.types';

class KetcherProvider {
private ketcherInstance: Ketcher | undefined;
Expand All @@ -33,9 +34,14 @@ export function getStructure(
formatterFactory: FormatterFactory,
struct: Struct,
drawingEntitiesManager?: DrawingEntitiesManager,
selection?: EditorSelection,
): Promise<string> {
const formatter = formatterFactory.create(structureFormat);
return formatter.getStructureFromStructAsync(struct, drawingEntitiesManager);
return formatter.getStructureFromStructAsync(
struct,
drawingEntitiesManager,
selection,
);
}

export async function prepareStructToRender(
Expand Down

0 comments on commit dc62239

Please sign in to comment.