Skip to content
Snippets Groups Projects
Commit 7bfe6b6b authored by chris's avatar chris
Browse files

focus back to surface for find-replace/special char

parent 6b81fb26
No related branches found
No related tags found
1 merge request!526new wrapper component
...@@ -12,6 +12,7 @@ import styled from 'styled-components'; ...@@ -12,6 +12,7 @@ import styled from 'styled-components';
import { grid, override } from '@pubsweet/ui-toolkit'; import { grid, override } from '@pubsweet/ui-toolkit';
import { WaxContext, MenuButton } from 'wax-prosemirror-core'; import { WaxContext, MenuButton } from 'wax-prosemirror-core';
import FindAndReplaceComponent from './FindAndReplaceComponent'; import FindAndReplaceComponent from './FindAndReplaceComponent';
import epigraphPoetry from '../../TrackChangeService/schema/trackChangesNodes/epigraphPoetryTrackNode';
const Wrapper = styled.div` const Wrapper = styled.div`
font-size: 0; font-size: 0;
...@@ -30,6 +31,7 @@ const DropWrapper = styled.div` ...@@ -30,6 +31,7 @@ const DropWrapper = styled.div`
const FindAndReplaceTool = ({ item }) => { const FindAndReplaceTool = ({ item }) => {
const { t, i18n } = useTranslation(); const { t, i18n } = useTranslation();
const { const {
activeView,
pmViews: { main }, pmViews: { main },
} = useContext(WaxContext); } = useContext(WaxContext);
...@@ -77,8 +79,10 @@ const FindAndReplaceTool = ({ item }) => { ...@@ -77,8 +79,10 @@ const FindAndReplaceTool = ({ item }) => {
active={isOpen} active={isOpen}
disabled={false} disabled={false}
iconName={icon} iconName={icon}
onMouseDown={() => { onMouseDown={e => {
e.preventDefault();
setIsOpen(!isOpen); setIsOpen(!isOpen);
activeView.focus();
}} }}
title={ title={
!isEmpty(i18n) && i18n.exists(`Wax.FindAndReplace.${title}`) !isEmpty(i18n) && i18n.exists(`Wax.FindAndReplace.${title}`)
...@@ -92,6 +96,7 @@ const FindAndReplaceTool = ({ item }) => { ...@@ -92,6 +96,7 @@ const FindAndReplaceTool = ({ item }) => {
<FindAndReplaceComponent <FindAndReplaceComponent
close={() => { close={() => {
setIsOpen(false); setIsOpen(false);
activeView.focus();
}} }}
/> />
</DropWrapper> </DropWrapper>
......
...@@ -28,6 +28,7 @@ const DropWrapper = styled.div` ...@@ -28,6 +28,7 @@ const DropWrapper = styled.div`
const SpecialCharactersTool = ({ item }) => { const SpecialCharactersTool = ({ item }) => {
const { t, i18n } = useTranslation(); const { t, i18n } = useTranslation();
const { const {
activeView,
pmViews: { main }, pmViews: { main },
} = useContext(WaxContext); } = useContext(WaxContext);
...@@ -50,8 +51,10 @@ const SpecialCharactersTool = ({ item }) => { ...@@ -50,8 +51,10 @@ const SpecialCharactersTool = ({ item }) => {
active={isOpen} active={isOpen}
disabled={isDisabled} disabled={isDisabled}
iconName={icon} iconName={icon}
onMouseDown={() => { onMouseDown={e => {
e.preventDefault();
setIsOpen(!isOpen); setIsOpen(!isOpen);
activeView.focus();
}} }}
title={ title={
!isEmpty(i18n) && i18n.exists(`Wax.SpecialCharacters.${title}`) !isEmpty(i18n) && i18n.exists(`Wax.SpecialCharacters.${title}`)
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment