[WEB-1689] fix: command enter submits the form (#4986)
* fix: command enter submits the form * fix: build errors
This commit is contained in:
parent
936c21d65e
commit
e78263e01f
12 changed files with 46 additions and 41 deletions
|
|
@ -64,7 +64,11 @@ export const LiteTextEditor = React.forwardRef<EditorRefApi, LiteTextEditorWrapp
|
|||
}}
|
||||
isSubmitting={isSubmitting}
|
||||
showSubmitButton={showSubmitButton}
|
||||
handleSubmit={(e) => rest.onEnterKeyPress?.(e)}
|
||||
handleSubmit={() => {
|
||||
if (isMutableRefObject<EditorRefApi>(ref)) {
|
||||
rest.onEnterKeyPress?.(ref.current?.getHTML() ?? "");
|
||||
}
|
||||
}}
|
||||
isCommentEmpty={isEmpty}
|
||||
editorRef={isMutableRefObject<EditorRefApi>(ref) ? ref : null}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ import { cn } from "@/helpers/common.helper";
|
|||
|
||||
type Props = {
|
||||
executeCommand: (commandName: EditorMenuItemNames) => void;
|
||||
handleSubmit: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
|
||||
handleSubmit: () => void;
|
||||
isCommentEmpty: boolean;
|
||||
isSubmitting: boolean;
|
||||
showSubmitButton: boolean;
|
||||
|
|
@ -95,7 +95,7 @@ export const IssueCommentToolbar: React.FC<Props> = (props) => {
|
|||
{showSubmitButton && (
|
||||
<div className="sticky right-1">
|
||||
<Button
|
||||
type="submit"
|
||||
type="button"
|
||||
variant="primary"
|
||||
className="px-2.5 py-1.5 text-xs"
|
||||
onClick={handleSubmit}
|
||||
|
|
|
|||
|
|
@ -66,8 +66,8 @@ export const AddComment: React.FC<Props> = observer((props) => {
|
|||
control={control}
|
||||
render={({ field: { value, onChange } }) => (
|
||||
<LiteTextEditor
|
||||
onEnterKeyPress={(e) => {
|
||||
if (currentUser) handleSubmit(onSubmit)(e);
|
||||
onEnterKeyPress={() => {
|
||||
if (currentUser) handleSubmit(onSubmit)();
|
||||
}}
|
||||
workspaceId={workspaceID?.toString() ?? ""}
|
||||
workspaceSlug={workspaceSlug?.toString() ?? ""}
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ export const CommentCard: React.FC<Props> = observer((props) => {
|
|||
<LiteTextEditor
|
||||
workspaceId={workspaceID?.toString() ?? ""}
|
||||
workspaceSlug={workspaceSlug?.toString() ?? ""}
|
||||
onEnterKeyPress={handleSubmit(handleCommentUpdate)}
|
||||
onEnterKeyPress={() => handleSubmit(handleCommentUpdate)()}
|
||||
ref={editorRef}
|
||||
initialValue={value}
|
||||
value={null}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue