Skip to content
Snippets Groups Projects
Commit 5f57e9c5 authored by chris's avatar chris
Browse files

fix fill the gap focus

parent 1b2da1a3
No related branches found
No related tags found
No related merge requests found
...@@ -170,7 +170,7 @@ const Hhmi = () => { ...@@ -170,7 +170,7 @@ const Hhmi = () => {
value={content} value={content}
readonly={readOnly} readonly={readOnly}
layout={HhmiLayout} layout={HhmiLayout}
onChange={source => console.log(source)} // onChange={source => console.log(source)}
/> />
</> </>
); );
......
...@@ -20,7 +20,7 @@ const Button = ({ view = {}, item }) => { ...@@ -20,7 +20,7 @@ const Button = ({ view = {}, item }) => {
const handleMouseDown = e => { const handleMouseDown = e => {
e.preventDefault(); e.preventDefault();
run(activeView.state, activeView.dispatch, activeView); run(activeView.state, activeView.dispatch, activeView, context);
}; };
const isActive = !!( const isActive = !!(
......
...@@ -11,7 +11,7 @@ class CreateGap extends Tools { ...@@ -11,7 +11,7 @@ class CreateGap extends Tools {
label = 'Create Gap'; label = 'Create Gap';
get run() { get run() {
return (state, dispatch) => { return (state, dispatch, activeView, context) => {
const { empty, $from, $to } = state.selection; const { empty, $from, $to } = state.selection;
let content = Fragment.empty; let content = Fragment.empty;
if (!empty && $from.sameParent($to) && $from.parent.inlineContent) if (!empty && $from.sameParent($to) && $from.parent.inlineContent)
...@@ -23,7 +23,11 @@ class CreateGap extends Tools { ...@@ -23,7 +23,11 @@ class CreateGap extends Tools {
{ id: uuidv4() }, { id: uuidv4() },
content, content,
); );
dispatch(state.tr.replaceSelectionWith(createGap)); dispatch(state.tr.replaceSelectionWith(createGap));
setTimeout(() => {
context.pmViews[createGap.attrs.id].focus();
}, 100);
}; };
} }
......
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