diff --git a/wax-prosemirror-services/src/FindAndReplaceService/components/FindAndReplaceTool.js b/wax-prosemirror-services/src/FindAndReplaceService/components/FindAndReplaceTool.js index da57e23fc80a59e65ddd646b8e06b8888af80c62..986968f53b4d69822bdabab9eb66dbc28d77b0e8 100644 --- a/wax-prosemirror-services/src/FindAndReplaceService/components/FindAndReplaceTool.js +++ b/wax-prosemirror-services/src/FindAndReplaceService/components/FindAndReplaceTool.js @@ -12,6 +12,7 @@ import styled from 'styled-components'; import { grid, override } from '@pubsweet/ui-toolkit'; import { WaxContext, MenuButton } from 'wax-prosemirror-core'; import FindAndReplaceComponent from './FindAndReplaceComponent'; +import epigraphPoetry from '../../TrackChangeService/schema/trackChangesNodes/epigraphPoetryTrackNode'; const Wrapper = styled.div` font-size: 0; @@ -30,6 +31,7 @@ const DropWrapper = styled.div` const FindAndReplaceTool = ({ item }) => { const { t, i18n } = useTranslation(); const { + activeView, pmViews: { main }, } = useContext(WaxContext); @@ -77,8 +79,10 @@ const FindAndReplaceTool = ({ item }) => { active={isOpen} disabled={false} iconName={icon} - onMouseDown={() => { + onMouseDown={e => { + e.preventDefault(); setIsOpen(!isOpen); + activeView.focus(); }} title={ !isEmpty(i18n) && i18n.exists(`Wax.FindAndReplace.${title}`) @@ -92,6 +96,7 @@ const FindAndReplaceTool = ({ item }) => { <FindAndReplaceComponent close={() => { setIsOpen(false); + activeView.focus(); }} /> </DropWrapper> diff --git a/wax-prosemirror-services/src/SpecialCharactersService/components/SpecialCharactersTool.js b/wax-prosemirror-services/src/SpecialCharactersService/components/SpecialCharactersTool.js index 04b4299c3f12cdd082f4b062d8e88ca27cc6e79d..6fb440fb5917b43495ff4412d3a4bbb5ea140c97 100644 --- a/wax-prosemirror-services/src/SpecialCharactersService/components/SpecialCharactersTool.js +++ b/wax-prosemirror-services/src/SpecialCharactersService/components/SpecialCharactersTool.js @@ -28,6 +28,7 @@ const DropWrapper = styled.div` const SpecialCharactersTool = ({ item }) => { const { t, i18n } = useTranslation(); const { + activeView, pmViews: { main }, } = useContext(WaxContext); @@ -50,8 +51,10 @@ const SpecialCharactersTool = ({ item }) => { active={isOpen} disabled={isDisabled} iconName={icon} - onMouseDown={() => { + onMouseDown={e => { + e.preventDefault(); setIsOpen(!isOpen); + activeView.focus(); }} title={ !isEmpty(i18n) && i18n.exists(`Wax.SpecialCharacters.${title}`)