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 = () => {
value={content}
readonly={readOnly}
layout={HhmiLayout}
onChange={source => console.log(source)}
// onChange={source => console.log(source)}
/>
</>
);
......
......@@ -20,7 +20,7 @@ const Button = ({ view = {}, item }) => {
const handleMouseDown = e => {
e.preventDefault();
run(activeView.state, activeView.dispatch, activeView);
run(activeView.state, activeView.dispatch, activeView, context);
};
const isActive = !!(
......
......@@ -11,7 +11,7 @@ class CreateGap extends Tools {
label = 'Create Gap';
get run() {
return (state, dispatch) => {
return (state, dispatch, activeView, context) => {
const { empty, $from, $to } = state.selection;
let content = Fragment.empty;
if (!empty && $from.sameParent($to) && $from.parent.inlineContent)
......@@ -23,7 +23,11 @@ class CreateGap extends Tools {
{ id: uuidv4() },
content,
);
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