Skip to content

Commit

Permalink
Merge branch 'master' into #2423-hotkeys-for-atoms-dont-work-on-funct…
Browse files Browse the repository at this point in the history
…ional-groups-and-salts-abbreviations
  • Loading branch information
AnastasiiaPlyako committed May 29, 2023
2 parents cbd3b59 + 3b46db1 commit 440be93
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 19 deletions.
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/ketcher-core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ketcher-core",
"version": "2.10.0-rc.2",
"version": "2.11.0-rc.1",
"description": "Web-based molecule sketcher",
"license": "Apache-2.0",
"homepage": "http://lifescience.opensource.epam.com/ketcher",
Expand Down
2 changes: 1 addition & 1 deletion packages/ketcher-react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ketcher-react",
"version": "2.10.0-rc.2",
"version": "2.11.0-rc.1",
"description": "Web-based molecule sketcher",
"license": "Apache-2.0",
"homepage": "http://lifescience.opensource.epam.com/ketcher",
Expand Down
4 changes: 2 additions & 2 deletions packages/ketcher-react/src/script/editor/tool/template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ class TemplateTool {
})
}

async mousedown(event) {
async mousedown(event: MouseEvent) {
this.event = event

if (this.functionalGroups.size) {
Expand Down Expand Up @@ -187,7 +187,7 @@ class TemplateTool {
this.editor.hover(null)

this.dragCtx = {
xy0: this.editor.render.page2obj(this.event),
xy0: this.editor.render.page2obj(event),
item: this.editor.findItem(this.event, this.findItems)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,14 @@
}
}

.loadingContainer {
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
}

.miewDarkTheme {
// stylelint-disable-next-line selector-pseudo-class-no-unknown
:global(.atom-info) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
* limitations under the License.
***************************************************************************/

import { Dialog } from '../../../../components'
import { lazy, Suspense, useCallback, useRef, useState } from 'react'
import { Dialog, LoadingCircles } from '../../../../components'
import {
FormatterFactory,
Struct,
Expand All @@ -26,9 +27,9 @@ import classes from './Miew.module.less'
import { connect } from 'react-redux'
import { load } from '../../../../../state'
import { pick } from 'lodash/fp'
import Viewer from 'miew-react'
import { Miew as MiewAsType } from 'miew'
import { useCallback, useRef } from 'react'

const Viewer = lazy(() => import('miew-react'))

type MiewDialogProps = {
miewOpts: any
Expand Down Expand Up @@ -117,6 +118,7 @@ const MiewDialog = ({
...prop
}: Props) => {
const miewRef = useRef<MiewAsType>()
const [isInitialized, setIsIsInitialized] = useState(false)

const onMiewInit = useCallback(
(miew: MiewAsType) => {
Expand All @@ -129,7 +131,10 @@ const MiewDialog = ({
.then((res) =>
miew.load(res, { sourceType: 'immediate', fileType: 'cml' })
)
.then(() => miew.setOptions(miewOpts))
.then(() => {
miew.setOptions(miewOpts)
setIsIsInitialized(true)
})
.catch((ex) => console.error(ex.message))
},
[miewOpts, server, struct]
Expand All @@ -150,7 +155,12 @@ const MiewDialog = ({
params={prop}
buttons={[
'Cancel',
<button key="apply" onClick={exportCML} className={classes.applyButton}>
<button
key="apply"
onClick={exportCML}
className={classes.applyButton}
disabled={!isInitialized}
>
Apply
</button>
]}
Expand All @@ -163,7 +173,15 @@ const MiewDialog = ({
miewTheme === 'dark' ? classes.miewDarkTheme : ''
}`}
>
<Viewer onInit={onMiewInit} />
<Suspense
fallback={
<div className={classes.loadingContainer}>
<LoadingCircles />
</div>
}
>
<Viewer onInit={onMiewInit} />
</Suspense>
</div>
</div>
</Dialog>
Expand Down
4 changes: 2 additions & 2 deletions packages/ketcher-standalone/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ketcher-standalone",
"version": "2.10.0-rc.2",
"version": "2.11.0-rc.1",
"description": "Web-based molecule sketcher",
"license": "Apache-2.0",
"homepage": "http://lifescience.opensource.epam.com/ketcher",
Expand Down Expand Up @@ -39,7 +39,7 @@
},
"dependencies": {
"@babel/runtime": "^7.17.9",
"indigo-ketcher": "1.11.0-rc.1",
"indigo-ketcher": "1.12.0-rc.1",
"ketcher-core": "*"
},
"devDependencies": {
Expand Down

0 comments on commit 440be93

Please sign in to comment.