Added in the toggle so when blurring from reply textbox it'll undo the reply button too

refs https://github.com/TryGhost/Team/issues/1703
This commit is contained in:
James Morris 2022-07-21 17:45:55 +01:00
parent 5466ca2608
commit b60f0995d9
2 changed files with 6 additions and 8 deletions

View File

@ -80,7 +80,7 @@ const Comment = (props) => {
leaveTo="opacity-0"
>
<div className="ml-14 my-10">
<Form parent={comment} toggle={toggleReplyMode} isReply={true} />
<Form parent={comment} toggle={toggleReplyMode} isReply={true} toggleReplyMode={toggleReplyMode} />
</div>
</Transition>
</>

View File

@ -35,11 +35,6 @@ const Form = (props) => {
...getEditorConfig(config)
});
// const isInViewport = () => {
// const top = formEl.current.getBoundingClientRect().top;
// return (top >= 0 && top <= window.innerHeight);
// };
const getScrollToPosition = () => {
let yOffset = -100;
const element = formEl.current;
@ -86,9 +81,12 @@ const Form = (props) => {
}, 100);
}
editor.on('blur', (editorObj) => {
editor.on('blur', () => {
if (editor?.isEmpty) {
setFormOpen(false);
if (props.isReply && props.toggleReplyMode) {
props.toggleReplyMode();
}
}
});
@ -108,7 +106,7 @@ const Form = (props) => {
});
})
.run();
}, [editor, props.isEdit, props.isReply, formEl]);
}, [editor, props, props.isEdit, props.isReply, props.toggleReplyMode]);
const submitForm = async (event) => {
event.preventDefault();