Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Redo doesn't work #4821

Open
1 of 2 tasks
angelopedroso opened this issue Jan 22, 2024 · 0 comments
Open
1 of 2 tasks

[Bug]: Redo doesn't work #4821

angelopedroso opened this issue Jan 22, 2024 · 0 comments
Labels
Category: Open Source The issue or pull reuqest is related to the open source packages of Tiptap. Type: Bug The issue or pullrequest is related to a bug

Comments

@angelopedroso
Copy link

angelopedroso commented Jan 22, 2024

Which packages did you experience the bug in?

extension-history, tiptap, hook form, react

What Tiptap version are you using?

2.1.16

What’s the bug you are facing?

Redo doesn't work when you define onUpdate or onBlur in useEditor

const editor = useEditor({
    extensions,
    editorProps: {
      attributes: {
        class:
          'h-60 overflow-y-auto rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 prose text-primary prose-strong:text-primary',
      },
    },
    content: description,
    onUpdate: ({ editor }) => onChange(editor.getHTML()),
  })

  useEffect(() => {
    editor?.commands.setContent(description, false, {
      preserveWhitespace: 'full',
    })
  }, [description, editor, onChange])
      <Button
        className="bg-white"
        onClick={() => editor.chain().focus().redo().run()}
        disabled={!editor.can().redo()}
        type="button"
      >
        <Redo className="h-6 w-6 stroke-black" />
      </Button>
<FormField
              control={form.control}
              name="message"
              render={({ field }) => (
                <FormItem>
                  <span
                    data-error={!!form.formState.errors.message}
                    className="cursor-default text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 data-[error=true]:text-destructive"
                  >
                    Mensagem
                  </span>
                  <FormControl>
                    <Editor
                      onChange={field.onChange}
                      description={field.value}
                      placeholder="Your message"
                    />
                  </FormControl>
                  <FormMessage />
                </FormItem>
              )}
            />

What browser are you using?

Chrome

Code example

No response

What did you expect to happen?

Tiptap send the content to the react hook form.

Anything to add? (optional)

No response

Did you update your dependencies?

  • Yes, I’ve updated my dependencies to use the latest version of all packages.

Are you sponsoring us?

  • Yes, I’m a sponsor. 💖
@angelopedroso angelopedroso added Category: Open Source The issue or pull reuqest is related to the open source packages of Tiptap. Type: Bug The issue or pullrequest is related to a bug labels Jan 22, 2024
@github-project-automation github-project-automation bot moved this to Triage open in Tiptap Jan 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Open Source The issue or pull reuqest is related to the open source packages of Tiptap. Type: Bug The issue or pullrequest is related to a bug
Projects
No open projects
Status: Triage open
Development

No branches or pull requests

1 participant