Move toasts to sonner (#6053)
This commit is contained in:
@@ -3,6 +3,7 @@ import capitalize from "lodash/capitalize";
|
||||
import * as React from "react";
|
||||
import { Trans } from "react-i18next";
|
||||
import { VisuallyHidden } from "reakit/VisuallyHidden";
|
||||
import { toast } from "sonner";
|
||||
import styled from "styled-components";
|
||||
import insertFiles from "@shared/editor/commands/insertFiles";
|
||||
import { EmbedDescriptor } from "@shared/editor/embeds";
|
||||
@@ -15,7 +16,6 @@ import { AttachmentValidation } from "@shared/validations";
|
||||
import { Portal } from "~/components/Portal";
|
||||
import Scrollable from "~/components/Scrollable";
|
||||
import useDictionary from "~/hooks/useDictionary";
|
||||
import useToasts from "~/hooks/useToasts";
|
||||
import Logger from "~/utils/Logger";
|
||||
import { useEditor } from "./EditorContext";
|
||||
import Input from "./Input";
|
||||
@@ -77,7 +77,6 @@ export type Props<T extends MenuItem = MenuItem> = {
|
||||
|
||||
function SuggestionsMenu<T extends MenuItem>(props: Props<T>) {
|
||||
const { view, commands } = useEditor();
|
||||
const { showToast: onShowToast } = useToasts();
|
||||
const dictionary = useDictionary();
|
||||
const hasActivated = React.useRef(false);
|
||||
const menuRef = React.useRef<HTMLDivElement>(null);
|
||||
@@ -292,7 +291,7 @@ function SuggestionsMenu<T extends MenuItem>(props: Props<T>) {
|
||||
const matches = "matcher" in insertItem && insertItem.matcher(href);
|
||||
|
||||
if (!matches) {
|
||||
onShowToast(dictionary.embedInvalidLink);
|
||||
toast.error(dictionary.embedInvalidLink);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -365,7 +364,6 @@ function SuggestionsMenu<T extends MenuItem>(props: Props<T>) {
|
||||
uploadFile,
|
||||
onFileUploadStart,
|
||||
onFileUploadStop,
|
||||
onShowToast,
|
||||
dictionary,
|
||||
isAttachment: inputRef.current?.accept === "*",
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user