Skip to content
Snippets Groups Projects
Commit 1bb20fc6 authored by chris's avatar chris
Browse files

back space fix

parent e5ea7d8e
No related branches found
No related tags found
1 merge request!190Find and replace
...@@ -7,12 +7,14 @@ import React, { ...@@ -7,12 +7,14 @@ import React, {
useCallback, useCallback,
useEffect, useEffect,
} from 'react'; } from 'react';
import { debounce } from 'lodash'; import { debounce, each } from 'lodash';
import styled from 'styled-components'; import styled from 'styled-components';
import { grid, th } from '@pubsweet/ui-toolkit'; import { grid, th } from '@pubsweet/ui-toolkit';
import { WaxContext } from 'wax-prosemirror-core'; import { WaxContext } from 'wax-prosemirror-core';
import Icon from '../../helpers/Icon'; import Icon from '../../helpers/Icon';
import { selectParentNode } from 'prosemirror-commands';
const Wrapper = styled.div` const Wrapper = styled.div`
width: 400px; width: 400px;
background: ${th('colorBackgroundHue')}; background: ${th('colorBackgroundHue')};
...@@ -75,8 +77,10 @@ const FindComponent = ({ close, expand, setPreviousSearcValue }) => { ...@@ -75,8 +77,10 @@ const FindComponent = ({ close, expand, setPreviousSearcValue }) => {
const { const {
app, app,
view: { main }, view: { main },
view,
} = useContext(WaxContext); } = useContext(WaxContext);
console.log(view);
const { const {
state: { doc, tr }, state: { doc, tr },
} = main; } = main;
...@@ -106,6 +110,10 @@ const FindComponent = ({ close, expand, setPreviousSearcValue }) => { ...@@ -106,6 +110,10 @@ const FindComponent = ({ close, expand, setPreviousSearcValue }) => {
const mergedTextNodes = []; const mergedTextNodes = [];
let index = 0; let index = 0;
each(view, (singleView, viewId) => {
// console.log(singleView, viewId);
});
doc.descendants((node, pos) => { doc.descendants((node, pos) => {
if (node.isText) { if (node.isText) {
if (mergedTextNodes[index]) { if (mergedTextNodes[index]) {
......
...@@ -51,12 +51,11 @@ const backSpaceShortCut = (state, dispatch, view) => { ...@@ -51,12 +51,11 @@ const backSpaceShortCut = (state, dispatch, view) => {
} }
}); });
backSpace( return backSpace(
state, state,
tr => dispatch(tr.setMeta('inputType', 'backwardsDelete')), tr => dispatch(tr.setMeta('inputType', 'backwardsDelete')),
view, view,
); );
return true;
}; };
const undoShortCut = (state, dispatch, view) => const undoShortCut = (state, dispatch, view) =>
......
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